MCPcopy Index your code
hub / github.com/coder/coder / validateHexColor

Function validateHexColor

enterprise/coderd/appearance.go:125–134  ·  view source on GitHub ↗
(color string)

Source from the content-addressed store, hash-verified

123}
124
125func validateHexColor(color string) error {
126 if len(color) != 7 {
127 return xerrors.New("expected # prefix and 6 characters")
128 }
129 if color[0] != '#' {
130 return xerrors.New("no # prefix")
131 }
132 _, err := hex.DecodeString(color[1:])
133 return err
134}
135
136// @Summary Update appearance
137// @ID update-appearance

Callers 1

putAppearanceMethod · 0.85

Calls 2

DecodeStringMethod · 0.80
NewMethod · 0.65

Tested by

no test coverage detected