whistyun / Markdown.Avalonia

render markdown with Avalonia UI
MIT License
301 stars 24 forks source link

Change Background to Transparent or we can call it DarkMode. #144

Open michalss opened 8 months ago

michalss commented 8 months ago

Hi,

I would like to use this in my project, however i need to have all components with transparent color to fit it into my color scheme. How can i do it please ?

image

whistyun commented 8 months ago

Do you use a style other than SimpleTheme, FluentTheme or AvaloniaFluent? Markdown.Avalonia will use a style that supports Dark if any of the above three styles are used. On the other hand, if not used, use a style that supports only Light.

If you want to use your own dark theme, you need to set the style from scratch. To do so, use the MarkdownScrollViewer.MarkdownStyle property.

<md:MarkdownScrollViewer>
  <md:MarkdownScrollViewer.MarkdownStyle>
    <StyleInclude Source="/Styles/MarkdownStyle.axaml"/>
  </md:MarkdownScrollViewer.MarkdownStyle>   
</md:MarkdownScrollViewer>

MarkdownStyleStandard.axaml may be a reference for available selectors and properties.