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

custom color themes? #207

Closed
giladgray opened this issue Sep 26, 2016 · 10 comments
Closed

custom color themes? #207

giladgray opened this issue Sep 26, 2016 · 10 comments
Assignees

Comments

@giladgray
Copy link

I'm interested in developing a custom coloring scheme for this editor. Not a language definition, jus the CSS styles to make languages look the way I like. I can't find any documentation on how to do this for the Monaco editor (found it for VSCode but I'm doubting .tmThemes are supported here).

It seems as though tokens are classed .token.{tokens...}.{language}, for instance .token.support.function.if.bat. My corresponding Atom theme already uses very similar classes. Is this an appropriate pattern to develop against?

@giladgray
Copy link
Author

well now I've found this: https://microsoft.github.io/monaco-editor/playground.html#customizing-the-appearence-tokens-and-colors. looks like i was on the right track!

@alexdima
Copy link
Member

@giladgray The vast majority of the tokens the tokenizers produce are found here -- https://github.com/Microsoft/monaco-languages/tree/master/src

An insane CSS file containing the default themes is found here -- https://github.com/Microsoft/vscode/blob/master/src/vs/editor/browser/standalone/media/standalone-tokens.css

Appologies for the insanity of the CSS file, it is quite a long story of how we ended up with this one :)... It involves shipping VSCode with half languages colorized using TM Grammars, half colorized using those tokenizers, thus half of those tokenizers got adjusted to emit TM style tokens, meanwhile the rest remained in a simple format that we used since more than 5 years.

I think at one point we should align all the tokenizers in monaco-languages with TextMate token names, but this is at this point a low priority item.

@alexdima alexdima self-assigned this Sep 26, 2016
@JulCesWhat
Copy link

@giladgray It seems that the background option does not work in the monaco.editor.IStandaloneThemeData rules. I was wondering if you could give me any insight on why would this be happening. Thanks.

@e9gille
Copy link

e9gille commented Feb 16, 2018

I just hit the same issue with the background option and managed to trace it to generateTokensCSSForColorMap in vs/editor/common/modes/supports/tokenization.ts

It seems all colors (whether foreground or background) are all turned into classes that only define a color css property. Any plans on getting this fixed?

@alexdima
Copy link
Member

alexdima commented Mar 13, 2018

@swashata
Copy link

I have a question regarding swashata/vscode-beautiful-ui#1 I have vscode theme defined with json. So all syntax highlighting of the tokens are already defined in the tokenColors hash, like

{
    "tokenColors": [
        {
            "settings": {
                "foreground": "#e7e2d0",
                "background": "#0f141a"
            }
        },
        {
            "name": "Comment",
            "scope": [
                "comment",
                "punctuation.definition.comment"
            ],
            "settings": {
                "fontStyle": "italic",
                "foreground": "#5d6874"
            }
        },
        {
            "name": "Variable",
            "scope": [
                "variable",
                "variable.other",
                "variable.name"
            ],
            "settings": {
                "foreground": "#e7e2d0"
            }
        },
        {
            "name": "Storage - modifier",
            "scope": [
                "storage.modifier"
            ],
            "settings": {
                "foreground": "#f07076"
            }
        },
    ]
}

Does all these scope has one-to-one mapping to the monaco editor rules. So that I can do something like

	rules: [
		{ token: 'variable.name', foreground: 'e7e2d0' },
		{ token: 'variable.other', foreground: 'e7e2d0' },
		{ token: 'storage.modifier', foreground: 'f07076' },
	]

The goal here is to replace ace editor with monaco editor of this site --> https://vscbui.rocks/

@brownbl1
Copy link

Is there a way to convert from .tmTheme to the json style expected here?

@Izhaki
Copy link

Izhaki commented Dec 1, 2018

Same question as @swashata :

How do you port something like vscode/extensions/theme-solarized-light/themes/solarized-light-color-theme.json with its tokenColors to the IStandaloneThemeData API?

https://gitlab.com/snippets/1728446?

@locohost
Copy link

locohost commented May 28, 2019

Yep, I'm trying to do this now myself. Is there a conversion guide anywhere detailing how to do this manually? Or a util that converts the VSCode themes so they will work in Monaco?There are soooooo many awesome VSCode themes. I'd love to use them in Monaco.

@alexdima
Copy link
Member

There is unfortunately no other documentation except the one I have linked to in my previous comment -- #207 (comment)

The TM themes that are used in vscode cannot be easily/mechanically transformed to Monaco Editor themes because the Monaco Editor does not use TM grammars for tokenization.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants