mirror of
https://github.com/home-assistant/frontend.git
synced 2026-04-17 23:54:28 +01:00
Add getContrastedColorHex() to be used for contrasted text & background (or vice versa) (#29032)
Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
This commit is contained in:
@@ -47,8 +47,11 @@ describe("Color Conversion Tests", () => {
|
||||
});
|
||||
|
||||
it("should convert theme color to hex (ignoring alpha)", () => {
|
||||
// Warning: theme2hex("red") returns a value of `--red-color` variable
|
||||
// which can differ from `#ff0000` on a particular Frontend client
|
||||
expect(theme2hex("red")).toBe("#ff0000");
|
||||
expect(theme2hex("ReD")).toBe("#ff0000");
|
||||
|
||||
expect(theme2hex("#ff0000")).toBe("#ff0000");
|
||||
expect(theme2hex("unicorn")).toBe("unicorn");
|
||||
expect(theme2hex("#abc")).toBe("#aabbcc");
|
||||
|
||||
Reference in New Issue
Block a user