micro-editor / micro-editor/micro

Custom colorscheme not loading: micro ignores or errors on .micro file (mermaid syntax)

Open
#3,763 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

Hi there — really enjoying using micro so far, thanks for the great tool!

issue:

I’m currently creating a custom syntax highlighting config (mermaid.yaml) for Mermaid.js .mmd files, and I also created a matching colorscheme file (mermaid.micro).

The syntax file works great when using built-in colorschemes like default, dukelight-tc, etc. — but when I switch to my custom Mermaid colorscheme micro throws parse errors and fails to apply any theming. I previousl had a working version of this colorscheme installed in micro but editting to try and get a little bit more it bawked completely. May have been me clearing the buffer just to see what happened when editing this or the Mermaid syntax file (see below). I rebuilt from scratch and now will not load. It took a lot of trail and error to get it working with a one line example to begin with. I kept adding to it.

> set colorscheme mermaid

I'm on macOS Sonoma v14.7.3 and running this inside of the iTerm2.app (shell) environment.

It defaults not to the default theme but to the shell environment colours i have set for my iTerm2 shell. There is zero syntax highlighting going on at all. It autocompletes the word mermaid in that context of setting the colorscheme; so micro certainly seems to know the file is in the right spot.

how to reproduce:

The colorschemes/mermaid.micro file loads, but micro fails with:

Color-link statement is not valid: class = "lightgreen"

Or:

Color-link statement is not valid: string2 = "lightmagenta"

The file is saved as UTF-8 with Unix line endings, and placed in:
~/.config/micro/colorschemes/mermaid.micro
📄 mermaid.micro.zip

# Mermaid colour scheme for Micro editor

default = "default"
comment = "gray"
constant = "lightblue"
identifier = "cyan"
special = "blue"
string = "magenta"
arrow = "red"
class = "lightgreen"

my syntax file, again saved as UTF-8 looks like this:
📄 mermaid.yaml.zip

filetype: mermaid

detect:
  filename: "\\.mmd$"

rules:
  - special: "\\b(subgraph|end|flowchart|graph|click|style|classDef|class|linkStyle)\\b"
  - identifier: "\\b[A-Z][0-9]*\\b"
  - comment: "%%.*"
    style: comment
  - constant: ":::?[a-zA-Z_][\\w-]*"
    style: class
  - string: '"[^"]*"'
  - arrow: "(-->|==>|-\\.|\\.->|-.->|-.->>)"

Previously i had single and double quotes being highlighted but this isn't working with this iteration of the colorscheme .ini file and the .yaml syntax file. Haven't manage to get arrows working so far.

After much playing around (hours) now the mermaid.micro file wont load at all. I tried creating the file as an .ini file then changing the name to …/colorschemes/mermaid.micro so that it appears as a .ini file in the status bar of micro but not sure its really doing anything different so far as loading the file is concerned.

💡 What I’ve tried:

  • Saving with BBEdit in UTF-8 + Unix LF format
  • Using known-good color names from built-in themes
  • Cleaning cache, backups, and restarting Micro
  • Confirmed syntax file still works with built-in colorschemes
  • starting out with an .ini file type for the mermaid.micro file and renaming it's filetype.
  • juggling around new names (e.g. "arrows:", "strings2:" for objects to pattern match against and then assigning them a style: using standard keywords like type, preproc, comment etc on the following line. but it always seems to end up breaking.
  • having a one to one binding between new names in the rules section of .yaml file and color assignements in the mermaid.micro colorscheme file.

❓ What I’m asking:

  • Is there a complete list of valid keys for custom .micro color scheme files?
  • Are custom styles like arrow or class allowed if referenced in syntax YAML?
  • Any known limitations for naming or ordering of color-link statements?
  • Any way to debug theme loading?

Thanks in advance for any guidance — happy to post sanitized examples or help test!

Screenshots comparing stock colorscheme and mermaid

Syntax Highlighting shown working in Fig. 1. using a stock colorscheme in dukelight-tc but losing all color in Fig. 2. having set my mermaid.micro colorscheme to me loaded.

Image

Figure 1. Mermaid syntax highlighting with the "dukelight-tc" colorscheme loaded.

Image

Figure 2. Mermaid syntax highlighting with my "mermaid" colorscheme loaded

(./config/micro/colourschemes/mermaid.micro). Absolutely nothing is getting coloured beyond the colours assigned to text and background in the iTerm2 shell environment.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing set colorscheme mermaid with colorschemes/mermaid.micro and the supplied mermaid.yaml, focusing on the reported invalid color-link keys. Read the custom colorscheme and syntax-highlighting configuration behavior, then verify that the Mermaid scheme loads without parse errors and preserves highlighting for the listed rules.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, yaml
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.