monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

Background color does not seems to be working on monaco.editor.defineTheme rules section.

Open JulCesWhat opened this issue 6 years ago • 14 comments

Background color does not seems to be working on monaco.editor.defineTheme rules array section. I am being able to set the foreground color and fontStyle, but for some reason the background color does not work. Any insight would be greatly appreciated.

monaco-editor version: 0.10.0 Browser: Chrome OS: Windows

JulCesWhat avatar Sep 16 '17 23:09 JulCesWhat

same for me, just added some code

 monaco.editor.defineTheme('myCoolTheme', {
      base: 'vs-dark',
      inherit: false,
      rules: [       
        { token: 'green', background: 'FF0000', foreground: '00FF00', fontStyle: 'italic'},
        { token: 'red', foreground: 'FF0000' , fontStyle: 'bold underline'},
        { background: '000000' },
        { foreground: 'FFFFFF' }
      ],
      colors: {
        'editor.foreground': '#FFFFFF',
        'editor.background': '#000000',
      }
    });

at line : { token: 'green', background: 'FF0000', foreground: '00FF00', fontStyle: 'italic'}, the rule that implies the "green" displays the background in black and not in green : FF0000

CedricDumont avatar Sep 18 '17 09:09 CedricDumont

Neither 'rules' nor colors definition works for me. Had to change color using CSS.

erenbaydemir avatar Sep 27 '17 12:09 erenbaydemir

+1

Also, can we not add the token name as css class? We seem to generate classs names as mtk{number}, depending on that is fragile as we change themes and rules

yaananth avatar Jul 19 '18 17:07 yaananth

This appears to be still non-functional. Just bumping for notice

ghardin137 avatar Aug 31 '18 23:08 ghardin137

And another bump, would love to see this bug fixed.

perkrlsn avatar May 16 '19 09:05 perkrlsn

Is there some alternative to workaround this bug ?

gmilano avatar Jun 13 '19 17:06 gmilano

another bump

mrQ000 avatar Oct 02 '19 04:10 mrQ000

bump, still not working

pcktm avatar Dec 28 '19 22:12 pcktm

Not working

cnayan avatar Jan 30 '20 12:01 cnayan

i would love to see a solution to this. for my use case, i am making the background of the editor transparent since i am displaying the code on top of video. because the video changes colors all the time i need to make the background of the text a solid color. since background of ITokenThemeRule is broken i have to use css to change background-color of the automatically generated mtk css class, which of course is very fragile. i'd like to fix it even just for my own purposes; can anyone point me to where these css classes are generated?

bandaloo avatar Mar 24 '21 20:03 bandaloo

Neither 'rules' nor colors definition works for me. Had to change color using CSS.

how did you add css ? do you rely on mtk class numbers ?

n-dragon avatar May 27 '21 13:05 n-dragon

I don't think relying on mtk class is safe. It seems to be somewhat auto generated based on our config. (e.g. changing the foreground color results in another class)

thien-do avatar Aug 26 '21 03:08 thien-do

Btw can someone point me the direction to fix this? I'd be happy to have a PR :D

thien-do avatar Aug 26 '21 03:08 thien-do

+1

Anu3ev avatar Aug 19 '22 12:08 Anu3ev

is it supposed to work at all or it was some mistake to expose it?

terpimost avatar Sep 28 '22 14:09 terpimost