-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rackover
committed
Feb 9, 2020
1 parent
2c8b8ba
commit 84ed36b
Showing
5 changed files
with
71 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
const color = require('color'); | ||
const cssPath = "/res/css/style.css" | ||
const fs = require("fs") | ||
const path = require("path") | ||
let scheme = {} | ||
|
||
module.exports = function(colString){ | ||
module.exports = { | ||
loadColor: loadColor, | ||
generateCSS: generateCSS, | ||
cssPath: cssPath | ||
} | ||
|
||
function loadColor(colString){ | ||
let baseColor = color(colString) | ||
|
||
return { | ||
lightest: baseColor.whiten(0.8), | ||
scheme = { | ||
lightest: baseColor.whiten(0.5), | ||
light: baseColor, | ||
dark: baseColor.darken(0.6), | ||
darkest: baseColor.darken(0.8), | ||
dark_grey: baseColor.darken(0.5).grayscale(), | ||
darkest_grey: baseColor.darken(0.8).grayscale(), | ||
light_grey: baseColor.whiten(2).grayscale() | ||
} | ||
} | ||
|
||
function generateCSS(){ | ||
return fs.readFileSync(path.join(APPLICATION_ROOT, "public", cssPath)) | ||
.toString() | ||
.replace(/darkest_grey/g, scheme.darkest_grey.rgb().string()) | ||
.replace(/light_grey/g, scheme.light_grey.rgb().string()) | ||
.replace(/dark_grey/g, scheme.dark_grey.rgb().string()) | ||
.replace(/darkest/g, scheme.darkest.rgb().string()) | ||
.replace(/lightest/g, scheme.lightest.rgb().string()) | ||
.replace(/dark/g, scheme.dark.rgb().string()) | ||
.replace(/light/g, scheme.light.rgb().string()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters