{"record":{"id":"6e07d01fe6ac5ffb","repo":"micro-editor/micro","slug":"s-is-not-a-valid-colorscheme","errorCode":null,"errorMessage":"%s is not a valid colorscheme","messagePattern":"(.+?) is not a valid colorscheme","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/colorscheme.go","lineNumber":82,"sourceCode":"\t\t\tColorscheme = c\n\t\t}\n\t}\n\n\treturn err\n}\n\n// LoadDefaultColorscheme loads the default colorscheme from $(ConfigDir)/colorschemes\nfunc LoadDefaultColorscheme() (map[string]tcell.Style, error) {\n\tvar parsedColorschemes []string\n\treturn LoadColorscheme(GlobalSettings[\"colorscheme\"].(string), &parsedColorschemes)\n}\n\n// LoadColorscheme loads the given colorscheme from a directory\nfunc LoadColorscheme(colorschemeName string, parsedColorschemes *[]string) (map[string]tcell.Style, error) {\n\tc := make(map[string]tcell.Style)\n\tfile := FindRuntimeFile(RTColorscheme, colorschemeName)\n\tif file == nil {\n\t\treturn c, errors.New(colorschemeName + \" is not a valid colorscheme\")\n\t}\n\tif data, err := file.Data(); err != nil {\n\t\treturn c, errors.New(\"Error loading colorscheme: \" + err.Error())\n\t} else {\n\t\tvar err error\n\t\tc, err = ParseColorscheme(file.Name(), string(data), parsedColorschemes)\n\t\tif err != nil {\n\t\t\treturn c, err\n\t\t}\n\t}\n\treturn c, nil\n}\n\n// ParseColorscheme parses the text definition for a colorscheme and returns the corresponding object\n// Colorschemes are made up of color-link statements linking a color group to a list of colors\n// For example, color-link keyword (blue,red) makes all keywords have a blue foreground and\n// red background\nfunc ParseColorscheme(name string, text string, parsedColorschemes *[]string) (map[string]tcell.Style, error) {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/micro-editor/micro/blob/1c8b82b32e408a5faf340039ed92d5266bea3293/internal/config/colorscheme.go#L64-L100","documentation":"Returned by config.LoadColorscheme when FindRuntimeFile(RTColorscheme, name) returns nil, i.e. no colorscheme file with that name is registered in any runtime search location (packaged runtime/colorschemes, ~/.config/micro/colorschemes, or plugin-contributed files). The returned map is empty, so callers fall back to whatever style map they had.","triggerScenarios":"Running `set colorscheme solarized` when no solarized.micro exists, putting \"colorscheme\": \"darcula\" in settings.json without installing darcula.micro, or a plugin that contributed the scheme not being loaded. LoadDefaultColorscheme at internal/config/colorscheme.go:82 uses GlobalSettings[\"colorscheme\"], so a bad name breaks startup loading too.","commonSituations":"Typos and casing mistakes (Micro must find e.g. 'solarized' matching solarized.micro), copying a settings.json from a machine where a custom scheme was installed, or extracting/shipping a micro binary without its runtime/colorschemes assets.","solutions":["List what exists: `set colorscheme ` + Tab completion, or ls ~/.config/micro/colorschemes and the packaged runtime/colorschemes directory.","Fix the name/casing to match the file basename exactly (file minus .micro extension).","Install the scheme: download the .micro file into ~/.config/micro/colorschemes/ and retry.","If packaged schemes are missing (custom build), rebuild so runtime assets are embedded/bundled, or copy the colorschemes dir next to the binary."],"exampleFix":"# before:\n> set colorscheme gruvbox   # file is gruvbox-boxy.micro? no -> error\n\n# after:\nmv ~/Downloads/gruvbox.micro ~/.config/micro/colorschemes/\n> set colorscheme gruvbox","handlingStrategy":"validation","validationCode":"func colorschemeExists(name string) bool {\n    return config.FindRuntimeFile(config.RTColorscheme, name) != nil\n}\n\nif !colorschemeExists(next) {\n    // keep current scheme instead of applying next\n}","typeGuard":"func isAvailableColorscheme(name string) bool {\n    for _, f := range config.ListRuntimeFiles(config.RTColorscheme) {\n        if f.Name() == name {\n            return true\n        }\n    }\n    return false\n}","tryCatchPattern":"styles, err := config.LoadColorscheme(name, &parsed)\nif err != nil {\n    if strings.HasSuffix(err.Error(), \"is not a valid colorscheme\") {\n        styles, err = config.LoadColorscheme(\"default\", &parsed) // safe fallback\n    }\n}","preventionTips":["Before writing \"colorscheme\" to settings.json or a theme switcher, check it against config.ListRuntimeFiles(RTColorscheme).","Ship custom .micro files inside ~/.config/micro/colorschemes with the exact basename you reference.","In theme plugins, register scheme files via AddRuntimeFile so they are discoverable."],"tags":["colorscheme","config","runtime-files","theming"],"backgroundTag":null,"analyzedSha":"1c8b82b32e408a5faf340039ed92d5266bea3293","analyzedAt":"2026-08-15T20:01:45.134Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}