diff --git a/src/components/ColorPicker.tsx b/src/components/ColorPicker.tsx
index 1359c166..16eed736 100644
--- a/src/components/ColorPicker.tsx
+++ b/src/components/ColorPicker.tsx
@@ -1,5 +1,6 @@
import React from "react";
import { Popover } from "./Popover";
+import { isTransparent } from "../utils";
import "./ColorPicker.scss";
import { isArrowKey, KEYS } from "../keys";
@@ -14,7 +15,7 @@ const isValidColor = (color: string) => {
};
const getColor = (color: string): string | null => {
- if (color === "transparent") {
+ if (isTransparent(color)) {
return color;
}
@@ -137,36 +138,41 @@ const Picker = ({
}}
tabIndex={0}
>
- {colors.map((_color, i) => (
-
- ))}
+ {colors.map((_color, i) => {
+ const _colorWithoutHash = _color.replace("#", "");
+ return (
+
+ );
+ })}
{showInput && (
{
expect(renderScene.mock.calls.length).toMatchSnapshot(
@@ -314,9 +315,9 @@ describe("contextMenu element", () => {
// Change some styles of second rectangle
clickLabeledElement("Stroke");
- clickLabeledElement("#c92a2a");
+ clickLabeledElement(t("colors.c92a2a"));
clickLabeledElement("Background");
- clickLabeledElement("#e64980");
+ clickLabeledElement(t("colors.e64980"));
// Fill style
fireEvent.click(screen.getByTitle("Cross-hatch"));
// Stroke width
diff --git a/src/tests/regressionTests.test.tsx b/src/tests/regressionTests.test.tsx
index ee542f93..57400b05 100644
--- a/src/tests/regressionTests.test.tsx
+++ b/src/tests/regressionTests.test.tsx
@@ -16,6 +16,7 @@ import {
} from "./test-utils";
import { defaultLang } from "../i18n";
import { FONT_FAMILY } from "../constants";
+import { t } from "../i18n";
const { h } = window;
@@ -168,9 +169,9 @@ describe("regression tests", () => {
mouse.up(10, 10);
clickLabeledElement("Background");
- clickLabeledElement("#fa5252");
+ clickLabeledElement(t("colors.fa5252"));
clickLabeledElement("Stroke");
- clickLabeledElement("#5f3dc4");
+ clickLabeledElement(t("colors.5f3dc4"));
expect(API.getSelectedElement().backgroundColor).toBe("#fa5252");
expect(API.getSelectedElement().strokeColor).toBe("#5f3dc4");
});
@@ -939,7 +940,7 @@ describe("regression tests", () => {
// change background color since default is transparent
// and transparent elements can't be selected by clicking inside of them
clickLabeledElement("Background");
- clickLabeledElement("#fa5252");
+ clickLabeledElement(t("colors.fa5252"));
mouse.down();
mouse.up(1000, 1000);
@@ -1046,7 +1047,7 @@ describe("regression tests", () => {
expect(screen.queryByText(/fill/i)).toBeNull();
clickLabeledElement("Background");
- clickLabeledElement("#fa5252");
+ clickLabeledElement(t("colors.fa5252"));
// select rectangle
mouse.reset();
mouse.click();