mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Use existing code
This commit is contained in:
parent
2947f9f6ff
commit
161e29b36e
@ -15,30 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
import type {ThemeInformation} from "./ThemeLoader";
|
||||
import {ColorSchemePreference} from "./ThemeLoader";
|
||||
import {offColor} from 'off-color';
|
||||
|
||||
function derive(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();
|
||||
return newColorString;
|
||||
}
|
||||
case "lighter": {
|
||||
const newColorString = offColor(value).lighten(argumentAsNumber / 100).hex();
|
||||
return newColorString;
|
||||
}
|
||||
}
|
||||
}
|
||||
import {derive} from "../../../scripts/postcss/color.mjs";
|
||||
|
||||
export class ThemeBuilder {
|
||||
// todo: replace any with manifest type when PR is merged
|
||||
|
Loading…
Reference in New Issue
Block a user