mirror of
https://github.com/home-assistant/frontend.git
synced 2026-05-08 17:28:46 +01:00
Fix theme2hex with custom theme colors (#24282)
This commit is contained in:
@@ -51,4 +51,16 @@ describe("Color Conversion Tests", () => {
|
||||
expect(theme2hex("#ff0000")).toBe("#ff0000");
|
||||
expect(theme2hex("unicorn")).toBe("unicorn");
|
||||
});
|
||||
|
||||
it("should convert rgb theme color to hex", () => {
|
||||
expect(theme2hex("rgb( 255, 0, 0)")).toBe("#ff0000");
|
||||
expect(theme2hex("rgb(0,255, 0)")).toBe("#00ff00");
|
||||
expect(theme2hex("rgb(0, 0,255 )")).toBe("#0000ff");
|
||||
});
|
||||
|
||||
it("should convert rgba theme color to hex by ignoring alpha", () => {
|
||||
expect(theme2hex("rgba( 255, 0, 0, 0.5)")).toBe("#ff0000");
|
||||
expect(theme2hex("rgba(0,255, 0, 0.3)")).toBe("#00ff00");
|
||||
expect(theme2hex("rgba(0, 0,255 , 0.7)")).toBe("#0000ff");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user