Theme · Importing: a long name gives way, four-digit colors read

A read theme's name is an Ellipsis that gives way beside its mode badge,
so a long name keeps the badge inside a 280px box. parse_hex reads #rgba
as VS Code does, each digit doubled, so a theme with a four-digit color
reads. Tests hold the badge inside the box and read #0008 as black at
0x88 alpha.
This commit is contained in:
ZacharyZhang-NY committed 2026-09-27 17:32:21 -04:00
1 parent 5f61f3e08d
commit d95ee5a88d
5 files changed
+60 -13

No files matched your search

+9 -1
View File
@@ -271,7 +271,7 @@ pub fn read_vscode_theme(text: &str) -> Result<VsCodeTheme> {
#[cfg(test)]
mod tests {
use gpui::rgb;
use gpui::{rgb, rgba};
use super::{plain, read_vscode_theme};
use crate::theme::{Mode, Palette};
@@ -311,6 +311,14 @@ mod tests {
assert_eq!(mode("hc-light"), Mode::Light);
}
#[test]
fn a_four_digit_color_reads_with_its_alpha() {
let theme =
read_vscode_theme(r##"{"type": "dark", "colors": {"widget.shadow": "#0008"}}"##)
.expect("a theme");
assert_eq!(theme.colors.shadow, rgba(0x00000088).into());
}
#[test]
fn a_terminal_color_reads_into_its_place() {
let theme =