Skip to content

Commit 29a1279

Browse files
fix(ColorGenerator): always prepend entered colors with pound sign (#2904)
1 parent 2dc8c1c commit 29a1279

File tree

1 file changed

+3
-2
lines changed
  • src/components/page/theming/ColorGenerator

1 file changed

+3
-2
lines changed

src/components/page/theming/ColorGenerator/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const ColorGenerator = (props) => {
4343
const { tint, shade, value } = color;
4444
const nameCap = name[0].toUpperCase() + name.substring(1);
4545

46+
const formattedValue = value.charAt(0) === '#' ? value : '#' + value;
4647
const isOpen = activeColor === name ? true : false;
4748

4849
return (
@@ -52,13 +53,13 @@ const ColorGenerator = (props) => {
5253
>
5354
<div className={styles.titleRow}>
5455
<div className={styles.titleRowStart}>
55-
<ColorDot color={value} />
56+
<ColorDot color={formattedValue} />
5657
{nameCap}
5758
</div>
5859
<div className={styles.titleRowEnd}>
5960
<ColorInput
6061
onClick={(ev) => ev.stopPropagation()}
61-
color={value}
62+
color={formattedValue}
6263
setColor={(color) =>
6364
setColors((colors) => {
6465
colors[name] = generateColor(color);

0 commit comments

Comments
 (0)