vadimdemedes / thememirror

🦚 Beautiful themes for CodeMirror
https://thememirror.net
199 stars 16 forks source link

selectionBackground has no effect #5

Open LaKing opened 1 year ago

LaKing commented 1 year ago

Hi, ..

I'm using the cobalt theme from thememirror. The only problem I face with this theme, is that the selected text highlighting needs more contrast, it is hard to see the selected area.

I've tried a few approaches, but couldn't make it. It seems like selectionBackground has no effect. Pure css seems to be overridden, at least for the background.

What is the recommended method for setting the highlighted text?

LaKing commented 1 year ago

For googlers finding this, the workaround is

let highlightTheme = EditorView.theme({
  "&.cm-focused .cm-selectionBackground, ::selection": {
    backgroundColor: "#D00"
  },
}, {dark: true});

extensions.push(highlightTheme);
JinXJinX commented 1 year ago

There is a typo in the create-theme.ts. This PR fixed that #7