Skip to content

Editor does not use the right theme #48936

Closed

Description

@ahmaxed

Describe the Issue

The layout theme and the editor theme does not match for users who are not signed in.

Affected Page

https://www.freecodecamp.org/learn/2022/responsive-web-design/learn-html-by-building-a-cat-photo-app/step-1

Steps to Reproduce

  1. Open an incognito window on a browser
  2. Go to https://www.freecodecamp.org/learn/2022/responsive-web-design/learn-html-by-building-a-cat-photo-app/step-1
  3. Compare the layout theme and the editor theme

Expected behavior

The editor should show the same theme as the layout.

Screenshots

Screen Shot 2023-01-03 at 3 12 59 PM

System

  • Browser: [Chrome, Safari]

Additional context

No response

Activity

  1. added
    platform: learn
    status: waiting triage
    on Jan 5, 2023
  2. Sboonny commented on Jan 5, 2023

    @Sboonny
    Member

    The issue with editor itself, if we don't have value for theme, it won't apply the desired theme.

    Here is the theme logic in the library.

              ...(theme ? { theme } : {}),

    https://github.com/react-monaco-editor/react-monaco-editor/blob/8dba5e38c43a6c52bf9a4ff9ef35893306b70df5/src/editor.tsx#L73

    Adding the JS script logic that decided the theme in this file

    const editorTheme = theme === Themes.Night ? 'vs-dark-custom' : 'vs-custom';
    , and deciding the value of the theme based on the camper color scheme, should fix this.

        window.matchMedia('(prefers-color-scheme: dark)').matches === true
          ? 'night'
          : 'default'

    Note: reading the component issues, it seems it doesn't work with NextJs 😞


    If you would like to fix this issue, please make sure you read our guidelines for contributing, we prioritize contributors following the instructions in our guides. Join us in our chat room or the forum if you need help contributing, our moderators will guide you through this.

  3. added
    help wanted
    and removed
    status: waiting triage
    on Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedplatform: learn

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions