Skip to content

Code block colors in Preview Mode ignore light/dark theme #97

@milen-yordanov

Description

@milen-yordanov

See the attached screenshots from https://overtype.dev/demo
In Preview Mode, code block colors always appear as if a dark theme is active, even when the light theme is selected. This makes code blocks look incorrect and inconsistent with the rest of the preview.

I traced the issue to the following styles, which hardcode dark-theme colors for preview mode:
https://github.com/panphora/overtype/blob/main/src/styles.js#L764-L773

    /* Code blocks - proper pre/code styling in preview mode */
    .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview pre.code-block {
      background: #2d2d2d !important;
      color: #f8f8f2 !important;
      padding: 1.2em !important;
      border-radius: 3px !important;
      overflow-x: auto !important;
      margin: 0 !important;
      display: block !important;
    }

Because these values are hardcoded, code blocks in Preview Mode do not adapt to the active light/dark theme.

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions