mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-11-20 11:36:24 +01:00
Invert operation for dark theme
This commit is contained in:
parent
bb9954a36c
commit
39bc827aaf
@ -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 New Issue
Block a user