mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 18:56:39 +00:00
Fix hex to rgb conversion (#6999)
This commit is contained in:
parent
7628569579
commit
fb75d8c1f2
@ -1,14 +1,14 @@
|
|||||||
import { derivedStyles, darkStyles } from "../../resources/styles";
|
import { darkStyles, derivedStyles } from "../../resources/styles";
|
||||||
import { HomeAssistant, Theme } from "../../types";
|
import { HomeAssistant, Theme } from "../../types";
|
||||||
import {
|
import {
|
||||||
hex2rgb,
|
hex2rgb,
|
||||||
|
lab2hex,
|
||||||
|
lab2rgb,
|
||||||
rgb2hex,
|
rgb2hex,
|
||||||
rgb2lab,
|
rgb2lab,
|
||||||
lab2rgb,
|
|
||||||
lab2hex,
|
|
||||||
} from "../color/convert-color";
|
} from "../color/convert-color";
|
||||||
|
import { labBrighten, labDarken } from "../color/lab";
|
||||||
import { rgbContrast } from "../color/rgb";
|
import { rgbContrast } from "../color/rgb";
|
||||||
import { labDarken, labBrighten } from "../color/lab";
|
|
||||||
|
|
||||||
interface ProcessedTheme {
|
interface ProcessedTheme {
|
||||||
keys: { [key: string]: "" };
|
keys: { [key: string]: "" };
|
||||||
@ -105,12 +105,12 @@ const processTheme = (
|
|||||||
const keys = {};
|
const keys = {};
|
||||||
for (const key of Object.keys(combinedTheme)) {
|
for (const key of Object.keys(combinedTheme)) {
|
||||||
const prefixedKey = `--${key}`;
|
const prefixedKey = `--${key}`;
|
||||||
const value = String(combinedTheme[key]!);
|
const value = String(combinedTheme[key]);
|
||||||
styles[prefixedKey] = value;
|
styles[prefixedKey] = value;
|
||||||
keys[prefixedKey] = "";
|
keys[prefixedKey] = "";
|
||||||
|
|
||||||
// Try to create a rgb value for this key if it is not a var
|
// Try to create a rgb value for this key if it is not a var
|
||||||
if (value.startsWith("#")) {
|
if (!value.startsWith("#")) {
|
||||||
// Can't convert non hex value
|
// Can't convert non hex value
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user