Conversation
|
Thanks for starting this. I was expecting something more strictly typed. For example: Intead of having these as "string", we can have it as: |
|
Reworked to a strictly typed configuration — no raw CSS strings anymore.
overrideThemes({
dark: {
extension,
previewStyles: {
markdownBody: { background: '#2a2734', color: '#eeebff' },
links: { color: '#9a86fd' },
inlineCode: { color: '#ffb870', background: '#36334280' },
},
},
});Happy to adjust the group/property set if you'd prefer a different shape. |
|
Can you revert unrelated source code re-format? |
e5a305b to
ec5b61f
Compare
|
Done — reverted the unrelated reformatting and squashed into a single commit. |
|
Sorry, I spent some time thinking about the relationship between the editor theme and the preview theme. It looks like the changes in this repo and https://github.com/MarkEdit-app/MarkEdit-theme-duotone are actually quite loosely coupled. What if we simply add the new preview themes to https://github.com/MarkEdit-app/MarkEdit-preview/blob/5b67059c116966ccbd0794d444864bb264f010c3/src/styling.ts#L50? That way:
|
|
Before I go ahead, let me make sure I understand the direction correctly. Do you mean that preview themes should live in MarkEdit-preview's built-in catalog ( Two data points to consider:
If the catalog approach is still what you prefer, I'm happy to start with a DuoTone port and follow up with the rest. Just want to confirm before creating a pile of PRs in the wrong direction. |
|
You asked a very interesting question, it looks like we really don't have a way to cleanly separate the responsibility due to the current architecture. A worse situation is: I am not even sure how "auto" themeName (in https://github.com/MarkEdit-app/MarkEdit-preview) would work for custom themes, theme extensions don't replace existing themes, they just override colors. |
I guess your current approach works for this quirk because as long as a That's quite interesting... |
|
Maybe your current approach is closer to the correct direction. However I don't quite get how auto would work still. Let's say I set the editor theme to GitHub and used a custom theme like VS Code, editorConfig would say GitHub instead of VS Code. In MarkEdit-preview changes, how would the auto theme pick colors from VS Code? |
Follow-up to the discussion in MarkEdit-app/MarkEdit-theme-duotone#1: instead of each theme hand-injecting a
<style>element, themes can now declare preview styling as configuration.CustomThemegains an optionalpreviewStyles?: string— CSS targeting the.markdown-bodyselector of MarkEdit-preview.previewStylesinsideupdateTheme, so it follows color-scheme changes, app theme switches, and the existingenabledModegating for free. No media queries needed in theme code.??=) because the shared__markeditTheming__context may have been initialized by an older bundled copy of the package in another theme.previewStylesis not provided.Usage:
dist/rebuilt withyarn build(lint passes). Once this lands and is tagged, I'll update the DuoTone PR to use the new field.