Skip to content

Commit 8b58302

Browse files
authored
Adjust formatColorInputDefaultValue to rgb value without commas (exercism#7879)
1 parent c7da04e commit 8b58302

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/javascript/components/bootcamp/CSSExercisePage/SimpleCodeMirror/extensions/interaction/handlers/handleColorNode/formatColorInputDefaultValue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { rgb2hex } from '../../utils'
33
export function formatColorInputDefaultValue(input: string): string {
44
if (input.startsWith('#')) return input
55

6-
const match = input.match(/rgb\s*\((\d+),\s*(\d+),\s*(\d+)\)/)
6+
const match = input.match(/rgb\s*\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)\s*\)/)
77
if (match) {
88
const [r, g, b] = match.slice(1).map(Number)
99
return rgb2hex(r, g, b)

0 commit comments

Comments
 (0)