uiwjs / uiwjs/react-codemirror
[themes] export theme settings separately for external use
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
Hello! I am just trying out the themes and they are really easy to use and look great inside the editor!
To be able to reuse the theme colors for other elements of the page, it would be great if the settings would be exported separately.
I tried to find a way to deduce the settings from the exported theme object, but the standardized keys background, foreground, caret, ... etc are gone. Also, the structure of that (huge) exported theme object seems to vary between different themes, so there is no way of knowing where a specific color is (at least I haven't found one)
This could be solved by exporting the settings object e.g.
export const defaultSettings = {
background: "#ffffff",
foreground: "#75baff",
caret: "#5d00ff",
selection: "#036dd626",
selectionMatch: "#036dd626",
lineHighlight: "#8a91991a",
gutterBackground: "#fff",
gutterForeground: "#8a919966",
};
export const abcdefInit = (options?: Partial<CreateThemeOptions>) => {
const { theme = 'dark', settings = {}, styles = [] } = options || {};
return createTheme({
theme: theme,
settings: {
...defaultSettings,
...settings,
},
/*
rest of theme
*/
});
What do you think? I could also send a PR if you like.
Anyways thanks for this cool lib! Happily using it with https://strudel.tidalcycles.org/
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the theme factory entry point that calls createTheme and inspect how the standardized settings are currently consumed. Compare the exported theme object with the proposed separate settings export, then define the public shape so callers can reuse colors without reverse-engineering theme structures. Done means theme settings are separately accessible for external use while existing theme creation continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100