forked from mystiq/hydrogen-web
Invert operation for dark theme
This commit is contained in:
parent
bb9954a36c
commit
39bc827aaf
1 changed files with 10 additions and 1 deletions
|
@ -16,8 +16,17 @@ limitations under the License.
|
||||||
|
|
||||||
const offColor = require("off-color").offColor;
|
const offColor = require("off-color").offColor;
|
||||||
|
|
||||||
module.exports.derive = function (value, operation, argument) {
|
module.exports.derive = function (value, operation, argument, isDark) {
|
||||||
const argumentAsNumber = parseInt(argument);
|
const argumentAsNumber = parseInt(argument);
|
||||||
|
if (isDark) {
|
||||||
|
// For dark themes, invert the operation
|
||||||
|
if (operation === 'darker') {
|
||||||
|
operation = "lighter";
|
||||||
|
}
|
||||||
|
else if (operation === 'lighter') {
|
||||||
|
operation = "darker";
|
||||||
|
}
|
||||||
|
}
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case "darker": {
|
case "darker": {
|
||||||
const newColorString = offColor(value).darken(argumentAsNumber / 100).hex();
|
const newColorString = offColor(value).darken(argumentAsNumber / 100).hex();
|
||||||
|
|
Loading…
Reference in a new issue