MCPcopy Index your code
hub / github.com/anomalyco/opencode / mode

Function mode

packages/opencode/src/cli/cmd/run/theme.ts:103–105  ·  view source on GitHub ↗
(bg: RGBA)

Source from the content-addressed store, hash-verified

101}
102
103function mode(bg: RGBA): "dark" | "light" {
104 return luminance(bg) > 0.5 ? "light" : "dark"
105}
106
107function luminance(color: RGBA): number {
108 return 0.299 * color.r + 0.587 * color.g + 0.114 * color.b

Callers 7

mapFunction · 0.70
resolveRunThemeFunction · 0.70
createPromptStateFunction · 0.70
refreshFunction · 0.70
cancelAutocompleteFunction · 0.70
runFunction · 0.70
submitPromptFunction · 0.70

Calls 1

luminanceFunction · 0.70

Tested by

no test coverage detected