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
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "lemoncurry/static/base16-materialtheme-scheme"]
|
||||
path = lemoncurry/static/base16-materialtheme-scheme
|
||||
url = git://github.com/ntpeters/base16-materialtheme-scheme.git
|
|
@ -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]));
|
||||
}
|
||||
};
|
||||
};
|
|
@ -4,6 +4,7 @@
|
|||
"repository": "https://gitlab.com/00dani/lemoncurry",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"js-yaml": "^3.10.0",
|
||||
"stylus": "^0.54.5"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
21
yarn.lock
21
yarn.lock
|
@ -6,6 +6,12 @@ amdefine@>=0.0.4:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
|
||||
|
||||
argparse@^1.0.7:
|
||||
version "1.0.9"
|
||||
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86"
|
||||
dependencies:
|
||||
sprintf-js "~1.0.2"
|
||||
|
||||
balanced-match@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||
|
@ -31,6 +37,10 @@ debug@*:
|
|||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
esprima@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804"
|
||||
|
||||
fs.realpath@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||
|
@ -57,6 +67,13 @@ inherits@2:
|
|||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||
|
||||
js-yaml@^3.10.0:
|
||||
version "3.10.0"
|
||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc"
|
||||
dependencies:
|
||||
argparse "^1.0.7"
|
||||
esprima "^4.0.0"
|
||||
|
||||
minimatch@^3.0.2:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
|
@ -101,6 +118,10 @@ source-map@0.1.x:
|
|||
dependencies:
|
||||
amdefine ">=0.0.4"
|
||||
|
||||
sprintf-js@~1.0.2:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||
|
||||
stylus@^0.54.5:
|
||||
version "0.54.5"
|
||||
resolved "https://registry.yarnpkg.com/stylus/-/stylus-0.54.5.tgz#42b9560931ca7090ce8515a798ba9e6aa3d6dc79"
|
||||
|
|
Loading…
Reference in a new issue