Commit Graph

205 Commits

Author SHA1 Message Date
Mikayla
8faa1f6e58
Merge branch 'main' into welcome 2023-11-27 18:55:23 -08:00
Nate Butler
c40ab3c3da Update theme2.rs 2023-11-27 09:11:51 -05:00
Nate Butler
48a9f2be4c Update one theme colors 2023-11-24 16:57:35 -05:00
Mikayla
663bbb06d9
WIP 2023-11-21 12:40:00 -08:00
Marshall Bowers
1b05aad30c
Extract Story into separate story crate (#3378)
This PR extracts the `Story` component into a separate `story` crate so
that it can be shared among various crates that define stories.

Release Notes:

- N/A

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2023-11-21 13:42:00 -05:00
Marshall Bowers
6cd0bcc578
Fix panic when opening settings in zed2 (#3375)
This PR fixes a panic that occurs when opening the settings in zed2.

We store the `ThemeRegistry` as a global without wrapping it in an
`Arc`, so we need to retrieve it the same way.

Release Notes:

- N/A
2023-11-21 10:58:52 -05:00
Mikayla
2c4d83c9af
WIP
co-authored-by: conrad <conrad@zed.dev>
co-authored-by: Nathan <nathan@zed.dev>
2023-11-20 14:46:01 -08:00
Conrad Irwin
0798cfd58c Merge branch 'main' into derive-element-redux 2023-11-20 09:15:38 -07:00
Nate Butler
176a68f90f kb 2023-11-20 10:46:23 -05:00
Nathan Sobo
adc355a1e6 Element refinement passing on ui2 2023-11-18 20:05:47 -07:00
Nathan Sobo
23ffce9fbe WIP: Work toward eliminating Component trait
This refactor enhances the overall design by promoting reusable and composable UI component structures within the Zed project codebase.
2023-11-18 00:03:23 -07:00
Julia
3655a96e54 Merge branch 'main' into unborked-git-zed2-diagnostics-view 2023-11-17 16:32:35 -05:00
Julia
c6d22af416 Get diagnostic2 tests building and running 2023-11-17 16:32:35 -05:00
Nate Butler
a526f23c81
Add ui_font settings and set default rem size accordingly (#3346)
[[PR Description]]
- Adds ui_font_family, ui_font_features, ui_font_size to settings and
default settings
- Use the new ui font settings to set the rem size when the workspace is
created.

Release Notes:

- N/A
2023-11-16 15:40:33 -05:00
Marshall Bowers
b559bfd80f
Parameterize theme2::init to allow loading just the base theme (#3345)
This PR adds a parameter to the `theme2::init` method to indicate what
the theme-loading behavior should be.

This allows us to indicate when we want to load all of the additional
built-in user themes (like in the Zed binary and in the storybook), and
when we don't want to load the user themes (like in tests).

We're using an enum over just a `bool` here for clarity at the call
site.

Release Notes:

- N/A
2023-11-16 13:03:30 -05:00
Nate Butler
c71e522b4e Allow users to set UI font properties in their settings
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-16 11:37:46 -05:00
Mikayla
7f72df6dcf
Merge branch 'main' into element-types 2023-11-14 15:49:10 -08:00
Mikayla
6b25841e2a
WIP 2023-11-14 14:48:34 -08:00
Nathan Sobo
364e3e7de5 Merge remote-tracking branch 'origin/main' into element-types 2023-11-14 01:55:58 -07:00
Nathan Sobo
c6e8a097a3 Rename back to div 2023-11-14 01:41:55 -07:00
Nathan Sobo
27fb381cca Checkpoint 2023-11-14 01:15:48 -07:00
Marshall Bowers
0430e8fbf2 Use "One Dark" as default theme 2023-11-13 18:44:17 -05:00
Marshall Bowers
53117eb5e5 Merge branch 'main' into one-themes 2023-11-13 18:16:45 -05:00
Nate Butler
fea5436ba9 Remove unused imports 2023-11-13 17:54:22 -05:00
Nate Butler
dd434588ee WIP 2023-11-13 17:38:44 -05:00
Nate Butler
97d6e7f2f5 Add one syntax theme 2023-11-13 17:09:55 -05:00
Nate Butler
c1887747b7 Add one_dark theme 2023-11-13 15:48:05 -05:00
Nate Butler
e0547d9acd Allow arrays of colors to be passed in 2023-11-13 15:47:57 -05:00
Nate Butler
916df3c614 Add color converter util 2023-11-13 15:28:20 -05:00
Marshall Bowers
04ad19d01b Choose appropriate player colors based on theme appearance 2023-11-13 15:07:13 -05:00
Nate Butler
889d20d046 Reorganize theme2 crate 2023-11-13 13:58:23 -05:00
Nate Butler
7be12cb7b1 Checkpoint Broken 2023-11-13 12:44:50 -05:00
Nate Butler
5361a499ae Checkpoint 2023-11-13 12:09:31 -05:00
Nate Butler
521972ed9e Update Status Colors 2023-11-13 11:56:42 -05:00
Marshall Bowers
6bc1cf0fae
Re-import the Synthwave 84 theme (#3297)
This PR re-imports the Synthwave 84 theme now that we support 3-value
hex colors.

Release Notes:

- N/A
2023-11-09 18:56:42 -05:00
Marshall Bowers
8bd02fdadc
Extend RGBA hex color parsing to support 3-value and 4-value variants (#3295)
This PR extends our support for parsing hex color codes to `Rgba` to
additionally support 3-value (`#rgb`) and 4-value (`#rgba`) formats.

See [here](https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color)
for more details on these hex color variants.

Release Notes:

- N/A
2023-11-09 18:27:47 -05:00
Marshall Bowers
8f5adeb9c3 Improve error conditions when parsing hex colors 2023-11-09 18:00:17 -05:00
Nate Butler
2347576fb5
Extend theme converter to allow multimatching against vscode colors (#3294)
[[PR Description]]

Adds the ability to specify a vec of VScode syntax scopes to match
against for a given syntax style.

Example:

```rust
pub fn to_vscode(&self) -> Vec<&'static str> {
        use ZedSyntaxToken::*;

        match self {
            SyntaxAttribute => vec!["entity.other.attribute-name"],
            SyntaxBoolean => vec!["constant.language"],
            SyntaxComment => vec!["comment"],
            SyntaxCommentDoc => vec!["comment.block.documentation"],
            SyntaxConstant => vec!["constant.character"],
            SyntaxConstructor => vec!["entity.name.function.definition.special.constructor"],
            SyntaxEmbedded => vec!["meta.embedded"],
            SyntaxEmphasis => vec!["markup.italic"],
            SyntaxEmphasisStrong => vec![
                "markup.bold",
                "markup.italic markup.bold",
                "markup.bold markup.italic",
            ],
            SyntaxEnum => vec!["support.type.enum"],
            SyntaxFunction => vec![
                "entity.name.function",
                "variable.function",
                "support.function",
            ],
            SyntaxKeyword => vec!["keyword"],
            SyntaxLabel => vec![
                "label",
                "entity.name",
                "entity.name.import",
                "entity.name.package",
            ],
            // .. more styles
}}
```

Useful `settings.json` for testing themes:

```json5
{
  // --- Dark Themes ---
  "theme": "Ayu Dark"
  // "theme": "Ayu Mirage"
  // "theme": "Dracula"
  // "theme": "Gruvbox Dark Hard"
  // "theme": "Gruvbox Dark Medium"
  // "theme": "Gruvbox Dark Soft"
  // "theme": "Night Owl"
  // "theme": "Noctis Obscuro"
  // "theme": "Noctis"
  // "theme": "Nord"
  // "theme": "Palenight (Mild Contrast)"
  // "theme": "Palenight Operator"
  // "theme": "Palenight"
  // "theme": "Rose Pine Moon"
  // "theme": "Rose Pine"
  // "theme": "Solarized Dark"
  // "theme": "Synthwave 84"
  // --- Light Themes ---
  // "theme": "Ayu Light"
  // "theme": "Gruvbox Light Hard"
  // "theme": "Gruvbox Light Medium"
  // "theme": "Gruvbox Light Soft"
  // "theme": "Noctis Lux"
  // "theme": "Rose Pine Dawn"
  // "theme": "Solarized Light"
}
```

Release Notes:

- N/A
2023-11-09 17:40:10 -05:00
Max Brunsfeld
b6eef26f91 Merge branch 'main' into search-query-suggestion-fixes 2023-11-09 14:18:17 -08:00
Nate Butler
6b65acaa99 regenerate themes, format 2023-11-09 16:48:35 -05:00
Nate Butler
4cd37e6e62 Extend theme converter to allow multimatching against vscode colors 2023-11-09 16:38:48 -05:00
Max Brunsfeld
28d3d21108 Generalize Refineable derive macro to derive arbitrary traits on the refinement type 2023-11-09 13:23:31 -08:00
Marshall Bowers
7b489f5e2e Allow user-theme related methods to be unused 2023-11-09 15:16:59 -05:00
Nate Butler
1c6a960bbf Deal with special case where a VSCode theme doesn't have a foreground color
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-09 14:53:04 -05:00
Nate Butler
54157eb99a Finish passing Syntax from VSCode themes to Zed Themes
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-09 14:41:26 -05:00
Nate Butler
ff053890cf Extend UserSyntax to allow font_style and font_weight to be specified
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-09 13:46:08 -05:00
Marshall Bowers
978cff8095 Use IndexMap for a deterministic order when importing syntax colors 2023-11-09 13:12:36 -05:00
Marshall Bowers
34e31fd489 Properly emit UserHighlightStyles 2023-11-09 12:59:20 -05:00
Marshall Bowers
ff19a0ca18 Add importing-themes feature flag to theme2 crate
When this feature is set the `themes` module won't be compiled.
This allows us to run the `theme_importer` even when the `themes` module
has compile errors in it.
2023-11-09 12:49:16 -05:00
Marshall Bowers
60eae3e50a Emit unique highlights for each syntax token 2023-11-09 12:46:37 -05:00
Nate Butler
efd1db1b09 WIP – Add Syntax themes to importer
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-09 12:30:53 -05:00
Nate Butler
4b5ca3e420 Allow imported themes to refine StatusColors
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-09 11:30:59 -05:00
Nate Butler
bdeb32c34b Extend VSCode theme importer 2023-11-09 01:39:31 -05:00
Nate Butler
25c8b19dfb WIP 2023-11-09 01:21:22 -05:00
Nate Butler
b5f60b7e50 Merge branch 'main' into update-workspace-styles 2023-11-09 00:38:06 -05:00
Conrad Irwin
b90e34aeb2
go to line2 (#3261)
- MODAL
- center a div
- MOAR CODE
- Beautiful go to line modal


Release Notes:
- N/A
2023-11-08 17:16:00 -07:00
Nate Butler
e505fb330c WIP 2023-11-08 16:43:32 -05:00
Nate Butler
23a97f5b61
Document ColorScaleSteps (#3271)
[[PR Description]]

Adds documentation to ColorScaleSteps:

```rust
/// Returns the specified step in the [`ColorScale`].
    #[inline]
    pub fn step(&self, step: ColorScaleStep) -> Hsla {
        // Steps are one-based, so we need convert to the zero-based vec index.
        self.0[step.0 - 1]
    }

    /// `Step 1` - Used for main application backgrounds.
    ///
    /// This step provides a neutral base for any overlaying components, ideal for applications' main backdrop or empty spaces such as canvas areas.
    ///
    #[inline]
    pub fn step_1(&self) -> Hsla {
        self.step(ColorScaleStep::ONE)
    }

    /// `Step 2` - Used for both main application backgrounds and subtle component backgrounds.
    ///
    /// Like `Step 1`, this step allows variations in background styles, from striped tables, sidebar backgrounds, to card backgrounds.
    #[inline]
    pub fn step_2(&self) -> Hsla {
        self.step(ColorScaleStep::TWO)
    }

    /// `Step 3` - Used for UI component backgrounds in their normal states.
    ///
    /// This step maintains accessibility by guaranteeing a contrast ratio of 4.5:1 with steps 11 and 12 for text. It could also suit hover states for transparent components.
    #[inline]
    pub fn step_3(&self) -> Hsla {
        self.step(ColorScaleStep::THREE)
    }

    /// `Step 4` - Used for UI component backgrounds in their hover states.
    ///
    /// Also suited for pressed or selected states of components with a transparent background.
    #[inline]
    pub fn step_4(&self) -> Hsla {
        self.step(ColorScaleStep::FOUR)
    }

    /// `Step 5` - Used for UI component backgrounds in their pressed or selected states.
    #[inline]
    pub fn step_5(&self) -> Hsla {
        self.step(ColorScaleStep::FIVE)
    }

    /// `Step 6` - Used for subtle borders on non-interactive components.
    ///
    /// Its usage spans from sidebars' borders, headers' dividers, cards' outlines, to alerts' edges and separators.
    #[inline]
    pub fn step_6(&self) -> Hsla {
        self.step(ColorScaleStep::SIX)
    }

    /// `Step 7` - Used for subtle borders on interactive components.
    ///
    /// This step subtly delineates the boundary of elements users interact with.
    #[inline]
    pub fn step_7(&self) -> Hsla {
        self.step(ColorScaleStep::SEVEN)
    }

    /// `Step 8` - Used for stronger borders on interactive components and focus rings.
    ///
    /// It strengthens the visibility and accessibility of active elements and their focus states.
    #[inline]
    pub fn step_8(&self) -> Hsla {
        self.step(ColorScaleStep::EIGHT)
    }

    /// `Step 9` - Used for solid backgrounds.
    ///
    /// `Step 9` is the most saturated step, having the least mix of white or black.
    ///
    /// Due to its high chroma, `Step 9` is versatile and particularly useful for semantic colors such as
    /// error, warning, and success indicators.
    #[inline]
    pub fn step_9(&self) -> Hsla {
        self.step(ColorScaleStep::NINE)
    }

    /// `Step 10` - Used for hovered or active solid backgrounds, particularly when `Step 9` is their normal state.
    #[inline]
    pub fn step_10(&self) -> Hsla {
        self.step(ColorScaleStep::TEN)
    }

    /// `Step 11` - Used for text and icons requiring low contrast or less emphasis.
    #[inline]
    pub fn step_11(&self) -> Hsla {
        self.step(ColorScaleStep::ELEVEN)
    }

    /// `Step 12` - Used for text and icons requiring high contrast or prominence.
    #[inline]
    pub fn step_12(&self) -> Hsla {
        self.step(ColorScaleStep::TWELVE)
    }
```

Release Notes:

- N/A
2023-11-08 16:25:17 -05:00
Mikayla
409e17ad30
Merge branch 'main' into go-to-line2 2023-11-08 11:32:36 -08:00
Marshall Bowers
b6766ba39a
Replace GitStatusColors with StatusColors (#3268)
This PR removes `GitStatusColors` in favor of just using `StatusColors`
instead.

Release Notes:

- N/A
2023-11-08 11:32:32 -05:00
Nate Butler
31bac3dd62 Document ColorScaleSteps 2023-11-08 00:45:05 -05:00
Nate Butler
0dd6ea6d41 Add new default player colors and the players story. 2023-11-07 21:51:12 -05:00
Nate Butler
79b4f78cb3 Extend the theme crate to enable stories, add players story 2023-11-07 21:08:33 -05:00
Nate Butler
a39865b4b2 Update default player colors 2023-11-07 20:27:00 -05:00
Conrad Irwin
7cdece4857 Beautiful go to line modal
Co-authored-by: Julia <julia@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
2023-11-07 15:32:34 -07:00
Nate Butler
df84ba4222 Continue documenting theme colors 2023-11-07 14:04:09 -05:00
Nate Butler
eb5fe3a3b9 Merge branch 'main' into document-theme 2023-11-07 13:36:08 -05:00
Nate Butler
91f356a2f1 Begin documenting theme colors 2023-11-07 13:36:01 -05:00
Antonio Scandurra
aa17adaac9 Merge remote-tracking branch 'origin/main' into editor-movement 2023-11-07 18:50:43 +01:00
Antonio Scandurra
d7e86eb1c1 Merge remote-tracking branch 'origin/main' into editor-movement 2023-11-07 18:48:08 +01:00
Marshall Bowers
25876161f8
theme_importer: Format generated themes (#3255)
This PR makes the `theme_importer` format the themes that it generates
automatically.

Release Notes:

- N/A
2023-11-07 12:45:09 -05:00
Marshall Bowers
0d95410634
Rework third-party themes (#3254)
This PR reworks the way we define our third-party themes to make them
work as overlays on top of a base theme.

We introduce the concept of a `UserThemeFamily` that contains
`UserTheme`s. Rather than being an entire theme definition on their own,
a `UserTheme` just contains optional overrides for the values in a
`Theme`.

When resolving a `UserTheme`, we apply it on top of the base theme. Any
values not overridden in the `UserTheme` will fall back to the `Theme`
defaults.

Right now we are just using `UserTheme` to model third-party themes that
we distribute with the Zed binary. However, this same structure can also
be used to import arbitrary user themes (such as from a theme registry,
or even a theme blob from the settings file).

Release Notes:

- N/A
2023-11-07 11:40:07 -05:00
Marshall Bowers
74853ea55f
Rename ThemeVariant to Theme (#3252)
This PR renames the `ThemeVariant` type to `Theme`.

This better reflects its purpose, as well as matches the same name as we
had before, which should make porting crates slightly easier.

Release Notes:

- N/A
2023-11-07 10:41:36 -05:00
Marshall Bowers
7078c5fbb9 Regenerate all themes 2023-11-07 08:59:50 -05:00
Marshall Bowers
01eac50fc8 Add new ThemeColors values to the theme printer 2023-11-07 08:59:37 -05:00
Antonio Scandurra
9f2e6be1b3 Fix warning 2023-11-07 14:31:17 +01:00
Antonio Scandurra
268be71d8e Add colors for document highlights 2023-11-07 13:15:08 +01:00
Antonio Scandurra
bdf6e8bcc7 Merge remote-tracking branch 'origin/main' into editor2-paint 2023-11-07 13:09:48 +01:00
Antonio Scandurra
6ae09634ce Remove focused field and use FocusHandle instead in Editor 2023-11-07 12:46:31 +01:00
Antonio Scandurra
a866370dc1 Paint lines 2023-11-07 12:25:33 +01:00
Nate Butler
3cb72610b3 Finish up initial themes 2023-11-06 15:24:36 -05:00
Nate Butler
62981fc2ee Format themes 2023-11-06 14:58:34 -05:00
Nate Butler
c47c64184c Add additional themes, update theme importer 2023-11-06 14:54:21 -05:00
Nate Butler
80f80df5cf Add Noctis Theme 2023-11-06 12:43:10 -05:00
Marshall Bowers
f8504c349c Merge branch 'main' into import-theme 2023-11-06 12:08:46 -05:00
Marshall Bowers
bf80c1da5b
Rename fields in ThemeColors (#3242)
This PR applies a number of field renames in the `ThemeColors` struct
from the `import-theme` branch.

This will help prevent this branch from diverging too far from `main`.

Release Notes:

- N/A

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-06 11:53:27 -05:00
Antonio Scandurra
769526a76a Paint editor background 2023-11-06 15:54:09 +01:00
Nate Butler
1bce5dcc69 Add checkboxes and their stories 2023-11-05 01:06:41 -05:00
Max Brunsfeld
436dc93441 WIP2000 2023-11-03 16:40:37 -07:00
Marshall Bowers
287ea0a6e4
Allow deriving Serialize and Deserialize on generated refinement (#3227)
This PR adds support for deriving `Serialize` and `Deserialize` on the
refinement type generated by `#[derive(Refineable)]`.

Release Notes:

- N/A
2023-11-03 17:21:00 -04:00
Marshall Bowers
12500364b4 Merge branch 'main' into import-theme 2023-11-03 15:41:12 -04:00
Marshall Bowers
fa7d6c0e70
Remove Default impl for ThemeColors` (#3226)
This PR removes the `Default` impl for `ThemeColors`.

Since we need default light and dark variants for `ThemeColors`, we
can't use a single `Default` impl.

Release Notes:

- N/A
2023-11-03 15:40:50 -04:00
Antonio Scandurra
2a672e2126 WIP 2023-11-03 18:55:20 +01:00
Marshall Bowers
a7edd380e3 Merge branch 'main' into import-theme 2023-11-03 10:11:35 -04:00
Conrad Irwin
0b3932f38c Convert rich_text2 2023-11-02 19:30:33 -06:00
Nate Butler
b4e2368943 Merge branch 'main' into import-theme 2023-11-02 20:16:09 -04:00
Nate Butler
2b0c959137 Add terminal colors to ThemeColors, add _background to some color names. 2023-11-02 19:53:52 -04:00
Marshall Bowers
152ac6927f Add themes2/src/themes directory 2023-11-02 19:17:39 -04:00
Marshall Bowers
d1636bf16b Finish up theme printer 2023-11-02 19:14:51 -04:00
Marshall Bowers
e48332c81f Parse VSCode theme files 2023-11-02 18:00:55 -04:00