forked from 00dani/lemoncurry
Load the Material colour scheme directly from the source YAML, rather than hardcoding it into Stylus format
This commit is contained in:
parent
9d91cec6f9
commit
0419a844ce
8 changed files with 45 additions and 20 deletions
|
@ -192,7 +192,7 @@ STATICFILES_FINDERS = (
|
|||
)
|
||||
|
||||
COMPRESS_PRECOMPILERS = (
|
||||
('text/stylus', os.path.join(BASE_DIR, 'node_modules', '.bin', 'stylus') + ' {infile} -o {outfile}'),
|
||||
('text/stylus', './node_modules/.bin/stylus {infile} -u ./lemoncurry/static/lemoncurry/css/theme -o {outfile}'),
|
||||
)
|
||||
|
||||
MEDIA_URL = STATIC_URL + 'media/'
|
||||
|
|
1
lemoncurry/static/base16-materialtheme-scheme
Submodule
1
lemoncurry/static/base16-materialtheme-scheme
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit cbbc47444208fb8f28dbc48ea986c9dc81843e9a
|
|
@ -1,17 +0,0 @@
|
|||
// Source: https://github.com/ntpeters/base16-materialtheme-scheme/blob/cbbc474/material-darker.yaml
|
||||
$base00 = #212121
|
||||
$base01 = #303030
|
||||
$base02 = #353535
|
||||
$base03 = #4A4A4A
|
||||
$base04 = #B2CCD6
|
||||
$base05 = #EEFFFF
|
||||
$base06 = #EEFFFF
|
||||
$base07 = #FFFFFF
|
||||
$base08 = #F07178
|
||||
$base09 = #F78C6C
|
||||
$base0A = #FFCB6B
|
||||
$base0B = #C3E88D
|
||||
$base0C = #89DDFF
|
||||
$base0D = #82AAFF
|
||||
$base0E = #C792EA
|
||||
$base0F = #FF5370
|
|
@ -1,5 +1,3 @@
|
|||
@import 'base16-material-darker'
|
||||
|
||||
html
|
||||
background-color $base01
|
||||
|
||||
|
|
18
lemoncurry/static/lemoncurry/css/theme.js
Normal file
18
lemoncurry/static/lemoncurry/css/theme.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
const {join} = require('path');
|
||||
const {readFileSync} = require('fs');
|
||||
|
||||
const stylus = require('stylus');
|
||||
const {safeLoad} = require('js-yaml');
|
||||
|
||||
const themePath = join(__dirname, '..', '..', 'base16-materialtheme-scheme', 'material-darker.yaml');
|
||||
|
||||
module.exports = function() {
|
||||
const theme = safeLoad(readFileSync(themePath, 'utf8'));
|
||||
return function(style) {
|
||||
for (let i = 0; i < 16; i++) {
|
||||
const key = 'base0' + i.toString(16).toUpperCase();
|
||||
|
||||
style.define('$' + key, new stylus.nodes.Literal('#' + theme[key]));
|
||||
}
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue