Skip to content

如何修改latex公式、表格、mermaid图形的字体(与mermaid线条)颜色 #600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
taoerdie opened this issue Mar 31, 2025 · 6 comments · Fixed by #612
Closed

Comments

@taoerdie
Copy link

如何修改latex公式、表格、mermaid图形的字体(与mermaid线条)颜色。
因为定义了背景颜色,需要相对固定的配色方案。列表区域可以使用自定义css里面的listitem修改。但是这三个区域没有找到对应的css,尝试了几次默认颜色不会变化,而且这几个区域会受到深色模式影响变更颜色,请问能否在md内而不借助外部html编辑工具解决这个问题。

@YangFong
Copy link
Member

目前「自定义CSS」未支持修改此类样式,通过开发工具是可以修改:

Image

但肯定不够方便,需要等待增强。

@taoerdie
Copy link
Author

目前「自定义CSS」未支持修改此类样式,通过开发工具是可以修改:

Image 但肯定不够方便,需要等待增强。

收到谢谢。

@taoerdie
Copy link
Author

目前「自定义CSS」未支持修改此类样式,通过开发工具是可以修改:

Image 但肯定不够方便,需要等待增强。

能否贴下开发环境下代码截图,新手没搞定公式与mermaid

@YangFong
Copy link
Member

能否贴下开发环境下代码截图,新手没搞定公式与mermaid

我是在 F12 当中临时调整的,设置 color 值即可,如果你急着试试,那么可以参考我下方的图:

Image

Mermaid 调整:

Image

@taoerdie
Copy link
Author

taoerdie commented Apr 2, 2025

感谢,以上问题基本通过修改mermaid内部样式等方法解决了。遇到新的问题,h1-6标题内,引用背景图片失效,看了下f12,程序在解析冒号时断了,比如url('https://***')会在s处截止。能否解决这个问题?谢谢

Image

@YangFong
Copy link
Member

YangFong commented Apr 4, 2025

分别回答一下三个问题:

  1. 公式样式设置已经支持,参见 feat: support setting style of katex #610
  2. 背景图片已提交修复,参见 fix: style value segmentation error #612
  3. 关于 Mermaid 样式设定,我们暂时不会提供 CSS 来修改,而是使用 Mermaid 自有的配置方式,请参考文档进行修改:https://mermaid.js.org/config/theming.html

示例:

# test

```mermaid
pie
  title 为什么总是宅在家里?
  "喜欢宅" : 45
  "天气太热" : 70
  "穷" : 500
  "没人约" : 95
```

```mermaid
%%{
  init: {
    'theme': 'base',
    'themeVariables': {
      'primaryTextColor': '#f00'
    }
  }
}%%
pie
  title 为什么总是宅在家里?
  "喜欢宅" : 45
  "天气太热" : 70
  "穷" : 500
  "没人约" : 95
```

```mermaid
%%{
  init: {
    'theme': 'base',
    'themeVariables': {
      'primaryColor': '#BB2528',
      'primaryTextColor': '#fff',
      'primaryBorderColor': '#7C0000',
      'lineColor': '#F8B229',
      'secondaryColor': '#006100',
      'tertiaryColor': '#fff'
    }
  }
}%%
        graph TD
          A[Christmas] -->|Get money| B(Go shopping)
          B --> C{Let me think}
          B --> G[/Another/]
          C ==>|One| D[Laptop]
          C -->|Two| E[iPhone]
          C -->|Three| F[fa:fa-car Car]
          subgraph section
            C
            D
            E
            F
            G
          end

```

效果展示:

pie
  title 为什么总是宅在家里?
  "喜欢宅" : 45
  "天气太热" : 70
  "穷" : 500
  "没人约" : 95
Loading
%%{
  init: {
    'theme': 'base',
    'themeVariables': {
      'primaryTextColor': '#f00'
    }
  }
}%%
pie
  title 为什么总是宅在家里?
  "喜欢宅" : 45
  "天气太热" : 70
  "穷" : 500
  "没人约" : 95
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants