mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +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;
|
||||
|
||||
module.exports.derive = function (value, operation, argument) {
|
||||
module.exports.derive = function (value, operation, argument, isDark) {
|
||||
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) {
|
||||
case "darker": {
|
||||
const newColorString = offColor(value).darken(argumentAsNumber / 100).hex();
|
||||
|
Loading…
Reference in New Issue
Block a user