Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

fix: improve styles inside the editor #366

Merged
merged 1 commit into from
Apr 18, 2023
Merged

Conversation

tomoam
Copy link
Contributor

@tomoam tomoam commented Apr 14, 2023

Fixes #360

In addition to that, when set to dark-mode in OS and light-mode in learn.svelte.dev (and vice versa), I do not feel the css styles is good enough, so that fixes that as well.
I will add more details soon. I added it. please review.

@vercel
Copy link

vercel bot commented Apr 14, 2023

@tomoam is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

Comment on lines +22 to +25
.cm-editor .cm-activeLine {
background: var(--sk-back-translucent);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When dark mode in OS and light mode in learn.svelte.dev (and vice versa), the background of the active line looks like:

image


Adding the above code, it will only depend on the site's scheme, and will look like this:

image

@@ -53,61 +53,82 @@
}

.cm-editor .cm-selectionMatch {
background: rgba(0,0,0,0.2);
background: var(--selection-color);
Copy link
Contributor Author

@tomoam tomoam Apr 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The similar applies here as well:

image


image

Comment on lines +60 to +66
.cm-editor.cm-focused .cm-selectionBackground,
.cm-editor .cm-selectionBackground,
.cm-editor .cm-content ::selection {
background: var(--sk-theme-3);
opacity: .3;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The similar applies here as well:

image


image

Comment on lines 67 to +80
.cm-editor .cm-tooltip {
background: var(--sk-back-2);
color: var(--sk-text-1);
border: none;
border-radius: 2px;
overflow: hidden;
margin: 0.4rem 0;
filter: drop-shadow(1px 2px 5px rgba(0,0,0,0.1));
}
.cm-editor .cm-tooltip-hover {}

.cm-editor .cm-tooltip-hover {
border: none;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes #360.

image


image

Comment on lines +88 to +93

.cm-editor .cm-diagnostic-warning {
background: hsl(39, 100%, 70%);
background: var(--sk-theme-1-variant);
color: white;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The similar applies here as well:

image


image

Comment on lines 100 to 134
.cm-editor .cm-panels {
background: var(--sk-back-4);
color: var(--sk-text-1);
}

@media (prefers-color-scheme: dark) {
.cm-editor .cm-activeLineGutter {
background-color: var(--sk-back-3);
}
.cm-editor .cm-panels.cm-panels-top,
.cm-editor .cm-panels.cm-panels-bottom {
border-top: 1px solid var(--sk-back-5);
border-bottom: 1px solid var(--sk-back-5);
}

.cm-editor .cm-activeLine {
background-color: hsl(0, 0%, 40%, 0.2);
}
.cm-editor .cm-button {
background: var(--sk-back-5);
border: 2px solid transparent;
}

.cm-editor .cm-diagnostic-warning {
background: hsl(39, 100%, 20%);
}
.cm-editor .cm-button:active {
background: var(--sk-theme-2-variant);
}

.cm-editor .cm-diagnostic-warning {
background: hsl(39, 100%, 10%);
}
.cm-editor .cm-textfield {
background: var(--sk-back-1);
color: var(--sk-text-1);
border: 2px solid transparent;
}

.cm-editor.cm-focused .cm-selectionBackground,
.cm-editor .cm-selectionBackground,
.cm-editor .cm-content ::selection {
background: var(--sk-theme-3);
opacity: .3;
}
.cm-editor .cm-search button:focus-visible,
.cm-editor .cm-search input:focus-visible {
border: 2px solid var(--flash);
}

.cm-editor .cm-selectionMatch {
background: rgba(255, 255, 255, 0.2);
}
} No newline at end of file
.cm-editor .cm-search input[type='checkbox']:focus-visible {
outline: 2px solid var(--flash);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support dark mode for the search panel displayed by pressing Ctrl+F (Command+F on Mac).

image


image

@tomoam tomoam marked this pull request as ready for review April 14, 2023 15:42
Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you so much! Love the inline comments with before/after screenshots

@dummdidumm dummdidumm merged commit 5cc3d07 into sveltejs:main Apr 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dark mode autocompletion suggestions color with bad contrast
2 participants