Skip to content

Commit

Permalink
Add new param to to define a style color for story mviewer#21
Browse files Browse the repository at this point in the history
  • Loading branch information
Agath21 committed Jan 20, 2025
1 parent b89b9d7 commit 7b62962
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Exemple :
##### theme
* prototype
**theme.**`css`: "url vers le fichier css à utliser pour personnaliser la storymap" (str).
* prototype
**theme.**`color`: "paramètre permettant de définir le code couleur de la storie (couleur des boutons et de la barre de progression pour le mode carousel. Si non définie, la couleur par défaut est #212529)" (str).

Exemple :
```
Expand Down
13 changes: 9 additions & 4 deletions js/storymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,19 @@ ks = (function() {
if (options.theme && options.theme.css) {
var cssfile = [_conf, options.theme.css].join("");
$('head').append('<link rel="stylesheet" href="'+cssfile+'" type="text/css" />');
} else if (options.theme && options.theme.color) {
$("#content-title").css("color", options.theme.color);
}
}
//Add style variables
var styleNode = document.createElement('style');
document.getElementsByTagName('head')[0].appendChild(styleNode);
if(options.theme && options.theme.color){
var styleColorStorie = document.createTextNode(':root {--colorStorie :'+ options.theme.color +';}');
styleNode.appendChild(styleColorStorie);
}
//Map title
$("#content-title h1").text(options.data.title);
$("#content-title h3").text(options.data.subtitle);
//Map width
$("#map").css("width", options.map.width);
$("#map").css("width", options.map.width);
// templates config
_template = new templates[options.data.template.name](document, $("#template"));
// Config map features styles
Expand Down
2 changes: 1 addition & 1 deletion stories/demo_carousel/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"enabled":"true"
},
"theme": {
"css": "demo.css"
"color" : "#009688"
},
"tooltip": {
"fields": [
Expand Down
6 changes: 5 additions & 1 deletion templates/carousel.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,15 @@
margin: 0;
}

.progress-bar{
background-color: var(--colorStorie, #212529);
}

.carButton {
position: fixed;
z-index: 10;
cursor: pointer;
background-color: #212529;
background-color: var(--colorStorie, #212529);
color: white;
height: 45px;
width: 45px;
Expand Down

0 comments on commit 7b62962

Please sign in to comment.