carbon-a-release / theme.js
lvwerra's picture
lvwerra HF Staff
Show more atlas silhouettes with branch-scaled sizes and dark grey outlines
586e4b7 verified
Raw History Blame Contribute Delete
1.16 kB
// Shared colours for CSS, WebGL, Canvas and the original silhouette alpha masks.
const palettes={
dark:{background:'#080e13',green:'#29e99a',blue:'#789dff',ink:'#e6f0ed',muted:'#91a5a4',grid:'#203039',bar:'#39dba0',barHover:'#c0ffe2',missing:'#52656c',highlight:'#effff8',icon:'#d8e9e3',iconOutline:'#343b40'},
light:{background:'#ffffff',green:'#00b86b',blue:'#4167ec',ink:'#273b30',muted:'#748078',grid:'#e6ece8',bar:'#13895e',barHover:'#123e2a',missing:'#b9c3bd',highlight:'#15392c',icon:'#14221c',iconOutline:'#343b40'}
};
let theme=document.documentElement.dataset.theme||'dark',palette=palettes[theme];
function rgb(hex){return [1,3,5].map(i=>parseInt(hex.slice(i,i+2),16)/255)}
function setTheme(value){
theme=value;palette=palettes[theme];document.documentElement.dataset.theme=theme;
try{localStorage.setItem('carbon-a-theme',theme)}catch{}
const label='Switch to '+(theme==='dark'?'light':'dark')+' mode';
document.querySelector('#theme-toggle').setAttribute('aria-label',label);
document.querySelector('#theme-toggle').title=label;
if(window.POC)POC.theme=theme;
if(document.querySelector('#gene-dialog').open)geneModal();
schedule();
}