Styling GeoGirafe
Colors
You can style your GeoGirafe apps by overridden global CSS variables.
Update front/index.html and add the link to the custom.css file in the <head> section with:
...
<link rel="config-mobile-url" href="config.mobile.json" />
<link rel="stylesheet" href="custom.css" />
You can find all variables that can be overridden in the list here : https://gitlab.com/geogirafe/gg-viewer/-/blob/main/src/styles/variables.css
Replace the variables in front/custom.css with your variables. For example, here the default background color is configured to grey instead of white :
body {
--bkg-color: #ddd;
}
Below is a list of CSS variables that can be modified according to your colours, depending on whether you are using the dark or light theme.
Aucune variable détectée.
Fonts
Change to another system font
Geogirafe uses Arial as default font.
If you want to use a different system font, add an entry to custom.css to declare your font of choice:
body {
--font-family: Helvetica, Arial, sans-serif;
}
Change to a custom font
If you want to use a custom font, follow these steps:
-
Place the font file in
woff2format in a folderfonts. -
Create a file
fonts.cssto define your font-faces.
@font-face {
font-family: 'MyFont';
src: url('../assets/fonts/MyFont-Regular.woff2') format('woff2');
font-weight: 400;
font-style: normal;
}
- Include
fonts.cssin yourindex.html,mobile.htmlandiframe.html.
<link rel="stylesheet" href="src/styles/fonts.css" />
- Finally, add a new entry in your
custom.cssfile to declare your custom font:
body {
--font-family: 'MyFont', Arial, sans-serif;
}
Use custom icons
If you want to override the default icons with custom ones, follow these steps:
- Create a directory
src/assets/icons - Copy your custom icons in this directory.
To override an icon, you have to use the same name as the original one.
The list of all default icons can be found here: https://gitlab.com/geogirafe/gg-viewer/-/tree/main/src/assets/icons
Limitations
Please note that all icons cannot be overriden.
For performance reasons, some icons are directly integrated in the source code of the component.
This is the case for the checkbox and the caret icon in the treeview for example.
If overriding an icon does not work properly, this can be the reason. In this case you will have to extend the web-component to be able to redefine its template.