Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function highlighted in python even when excluded from colormate.semanticTokenTypes #3

Open
MalcolmMielle opened this issue Jan 4, 2024 · 1 comment

Comments

@MalcolmMielle
Copy link

That's kinda of all in the title :). My settings only have property in the parameters but function names are still highlighted in python.

Also, is it possible to specify a color theme? The default one is kinda clashing with my base color theme.

@Sawtaytoes
Copy link
Owner

Sawtaytoes commented Jan 4, 2024

Excluded colors still coloring

semanticTokenTypes is only part of what gets highlighted. There are both Semantic Tokens and TextMate Tokens that can be highlighted by ColorMate, and both have default values.

You're probably running up against the entity.name.function TextMate token.

You can either:

  1. Exclude entity.name.function from colormate.excludedTextMateTokenScopes.
  2. Set colormate.hasDefaultTextMateTokenScopes which removes all defaults.

These are the current defaults:

[
  "entity.name.function",
  "entity.name.section.markdown",
  "entity.name.tag",
  "entity.other.attribute-name",
  "support.type.property-name.json",
  "variable.other.property",
  "variable.other.readwrite.alias",
]

ColorMate targets both token types because semantic tokens miss a lot and don't allow the same fine-grained granularity that TextMate tokens have. The only issue is that TextMate tokens are per-language plugin whereas Semantic Tokens are both generic and global (which is why there's also an option to disable ColorMate on specific languages).

Changing the Color Theme (hashing algorithm)

You can change the Lighting and Saturation for both light and dark themes, but I haven't included a way to modify the CRC8 color hashes. It's literally a 100% conversion

It's literally as simple as this with a CRC8 hex hookup table for each red, green, and blue value:

character.charCodeAt(0) % 256

If it's a big thing for you, you could submit a PR to add a way to change it. Either change the CRC8 algorithm or add your own.

The way this works is based on how Colorcoder worked for Sublime Text. I got so used to those colors that I transplanted that Python algorithm into JS and surprisingly got it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants