Start loading new theme JSON format instead of TOML

Replaced remaining extends with javascript object extension.
Moved tokens/core.ts to tokens.ts and massaged the types to make it more
obvious when types don't match up.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Nathan Sobo
2022-04-04 12:13:59 -07:00
committed by Keith Simmons
parent 371ea7c552
commit 391aed3d66
23 changed files with 3283 additions and 2008 deletions
-411
View File
@@ -1,411 +0,0 @@
[text]
base = { family = "Zed Sans", size = 14 }
[workspace]
background = "$surface.0"
pane_divider = { width = 1, color = "$border.0" }
leader_border_opacity = 0.7
leader_border_width = 2.0
[workspace.titlebar]
height = 32
border = { width = 1, bottom = true, color = "$border.0" }
title = "$text.0"
avatar_width = 18
avatar = { corner_radius = 10, border = { width = 1, color = "#00000088" } }
avatar_ribbon = { background = "#ff0000", height = 3, width = 12 }
outdated_warning = { extends = "$text.2", size = 13 }
share_icon_color = "$text.2.color"
share_icon_active_color = "$text.0.color"
[workspace.titlebar.sign_in_prompt]
extends = "$text.2"
size = 13
underline = true
padding = { right = 8 }
[workspace.titlebar.hovered_sign_in_prompt]
extends = "$workspace.titlebar.sign_in_prompt"
color = "$text.1.color"
[workspace.titlebar.offline_icon]
padding = { right = 4 }
width = 16
color = "$text.2.color"
[workspace.tab]
height = 34
text = "$text.2"
padding = { left = 12, right = 12 }
icon_width = 8
spacing = 10
icon_close = "$text.2.color"
icon_close_active = "$text.0.color"
icon_dirty = "$status.info"
icon_conflict = "$status.warn"
border = { left = true, bottom = true, width = 1, color = "$border.0", overlay = true }
[workspace.active_tab]
extends = "$workspace.tab"
border.bottom = false
background = "$surface.1"
text = "$text.0"
[workspace.sidebar]
width = 30
border = { right = true, width = 1, color = "$border.0" }
[workspace.sidebar.resize_handle]
padding = { left = 1 }
background = "$border.0"
[workspace.sidebar.item]
icon_color = "$text.2.color"
icon_size = 18
height = "$workspace.tab.height"
[workspace.sidebar.active_item]
extends = "$workspace.sidebar.item"
icon_color = "$text.0.color"
[workspace.left_sidebar]
extends = "$workspace.sidebar"
border = { width = 1, color = "$border.0", right = true }
[workspace.right_sidebar]
extends = "$workspace.sidebar"
border = { width = 1, color = "$border.0", left = true }
[workspace.status_bar]
padding = { left = 6, right = 6 }
height = 24
item_spacing = 8
cursor_position = "$text.2"
diagnostic_message = "$text.2"
lsp_message = "$text.2"
[workspace.toolbar]
background = "$surface.1"
border = { color = "$border.0", width = 1, left = false, right = false, bottom = true, top = false }
height = 34
item_spacing = 8
padding = { left = 16, right = 8, top = 4, bottom = 4 }
[breadcrumbs]
extends = "$text.1"
padding = { left = 6 }
[panel]
padding = { top = 12, left = 12, bottom = 12, right = 12 }
[chat_panel]
extends = "$panel"
channel_name = { extends = "$text.0", weight = "bold" }
channel_name_hash = { text = "$text.2", padding.right = 8 }
[chat_panel.message]
body = "$text.1"
sender = { extends = "$text.0", weight = "bold", margin.right = 8 }
timestamp = "$text.2"
padding.bottom = 6
[chat_panel.pending_message]
extends = "$chat_panel.message"
body = { color = "$text.3.color" }
sender = { color = "$text.3.color" }
timestamp = { color = "$text.3.color" }
[chat_panel.channel_select.item]
padding = 4
name = "$text.1"
hash = { extends = "$text.2", margin.right = 8 }
[chat_panel.channel_select.hovered_item]
extends = "$chat_panel.channel_select.item"
background = "$state.hover"
corner_radius = 6
[chat_panel.channel_select.active_item]
extends = "$chat_panel.channel_select.item"
name = "$text.0"
[chat_panel.channel_select.hovered_active_item]
extends = "$chat_panel.channel_select.hovered_item"
name = "$text.0"
[chat_panel.channel_select.header]
extends = "$chat_panel.channel_select.active_item"
padding.bottom = 4
padding.left = 0
[chat_panel.channel_select.menu]
padding = 4
corner_radius = 6
border = { color = "$border.0", width = 1 }
background = "$surface.0"
shadow = { offset = [0, 2], blur = 16, color = "$shadow.0" }
[chat_panel.input_editor]
background = "$surface.1"
corner_radius = 6
padding = { left = 8, right = 8, top = 7, bottom = 7 }
text = "$text.0"
placeholder_text = "$text.2"
selection = "$selection.host"
border = { width = 1, color = "$border.0" }
[chat_panel.sign_in_prompt]
extends = "$text.0"
underline = true
[chat_panel.hovered_sign_in_prompt]
extends = "$chat_panel.sign_in_prompt"
color = "$text.1.color"
[contacts_panel]
extends = "$panel"
host_row_height = 28
host_avatar = { corner_radius = 10, width = 18 }
host_username = { extends = "$text.0", padding.left = 8 }
tree_branch_width = 1
tree_branch_color = "$surface.2"
[contacts_panel.project]
height = 24
padding = { left = 8 }
guest_avatar = { corner_radius = 8, width = 14 }
guest_avatar_spacing = 4
[contacts_panel.project.name]
extends = "$text.1"
margin = { right = 6 }
[contacts_panel.unshared_project]
extends = "$contacts_panel.project"
[contacts_panel.hovered_unshared_project]
extends = "$contacts_panel.unshared_project"
background = "$state.hover"
corner_radius = 6
[contacts_panel.shared_project]
extends = "$contacts_panel.project"
name.color = "$text.0.color"
[contacts_panel.hovered_shared_project]
extends = "$contacts_panel.shared_project"
background = "$state.hover"
corner_radius = 6
[project_panel]
extends = "$panel"
padding.top = 6 # ($workspace.tab.height - $project_panel.entry.height) / 2
[project_panel.entry]
text = "$text.1"
height = 22
icon_color = "$text.3.color"
icon_size = 8
icon_spacing = 8
[project_panel.hovered_entry]
extends = "$project_panel.entry"
background = "$state.hover"
[project_panel.selected_entry]
extends = "$project_panel.entry"
text = { extends = "$text.0" }
[project_panel.hovered_selected_entry]
extends = "$project_panel.hovered_entry"
text = { extends = "$text.0" }
[selector]
background = "$surface.0"
padding = 8
margin = { top = 52, bottom = 52 }
corner_radius = 6
shadow = { offset = [0, 2], blur = 16, color = "$shadow.0" }
border = { width = 1, color = "$border.0" }
[selector.input_editor]
background = "$surface.1"
corner_radius = 6
padding = { left = 16, right = 16, top = 7, bottom = 7 }
text = "$text.0"
placeholder_text = "$text.2"
selection = "$selection.host"
border = { width = 1, color = "$border.0" }
[selector.empty]
text = "$text.2"
padding = { left = 16, right = 16, top = 8, bottom = 4 }
[selector.item]
text = "$text.1"
highlight_text = { extends = "$text.base", color = "$editor.syntax.keyword.color", weight = "$editor.syntax.keyword.weight" }
padding = { left = 16, right = 16, top = 4, bottom = 4 }
corner_radius = 6
[selector.active_item]
extends = "$selector.item"
background = "$state.hover"
text = "$text.0"
[editor]
text_color = "$text.1.color"
background = "$surface.1"
gutter_background = "$surface.1"
gutter_padding_factor = 2.5
active_line_background = "$state.active_line"
highlighted_line_background = "$state.highlighted_line"
rename_fade = 0.6
unnecessary_code_fade = 0.5
document_highlight_read_background = "#99999920"
document_highlight_write_background = "#99999916"
diff_background_deleted = "$state.deleted_line"
diff_background_inserted = "$state.inserted_line"
line_number = "$text.2.color"
line_number_active = "$text.0.color"
selection = "$selection.host"
guest_selections = "$selection.guests"
error_color = "$status.bad"
code_actions_indicator = "$text.3.color"
[editor.diagnostic_path_header]
background = "$state.active_line"
filename = { extends = "$text.0", size = 14 }
path = { extends = "$text.2", size = 14, margin.left = 12 }
text_scale_factor = 0.857
[editor.diagnostic_header]
background = "$editor.background"
border = { width = 1, top = true, bottom = true, color = "$border.1" }
code = { extends = "$text.2", size = 14, margin.left = 10 }
icon_width_factor = 1.5
text_scale_factor = 0.857
[editor.diagnostic_header.message]
text = { extends = "$text.1", size = 14 }
highlight_text = { extends = "$text.0", size = 14, weight = "bold" }
[editor.error_diagnostic]
header.border = { width = 1, top = true, color = "$border.0" }
text_scale_factor = 0.857
[editor.error_diagnostic.message]
text = { extends = "$text.1", size = 14, color = "$status.bad" }
highlight_text = { extends = "$text.1", size = 14, color = "$status.bad", weight = "bold" }
[editor.warning_diagnostic]
extends = "$editor.error_diagnostic"
message.text.color = "$status.warn"
message.highlight_text.color = "$status.warn"
[editor.information_diagnostic]
extends = "$editor.error_diagnostic"
message.text.color = "$status.info"
message.highlight_text.color = "$status.info"
[editor.hint_diagnostic]
extends = "$editor.error_diagnostic"
message.text.color = "$status.info"
message.highlight_text.color = "$status.info"
[editor.invalid_error_diagnostic]
extends = "$editor.error_diagnostic"
message.text.color = "$text.3.color"
message.highlight_text.color = "$text.3.color"
[editor.invalid_warning_diagnostic]
extends = "$editor.warning_diagnostic"
message.text.color = "$text.3.color"
message.highlight_text.color = "$text.3.color"
[editor.invalid_information_diagnostic]
extends = "$editor.information_diagnostic"
message.text.color = "$text.3.color"
message.highlight_text.color = "$text.3.color"
[editor.invalid_hint_diagnostic]
extends = "$editor.hint_diagnostic"
message.text.color = "$text.3.color"
message.highlight_text.color = "$text.3.color"
[editor.autocomplete]
background = "$surface.2"
border = { width = 2, color = "$border.1" }
corner_radius = 6
padding = 6
match_highlight = { color = "$editor.syntax.keyword.color", weight = "$editor.syntax.keyword.weight" }
margin.left = -14
[editor.autocomplete.item]
padding = { left = 6, right = 6, top = 2, bottom = 2 }
corner_radius = 6
[editor.autocomplete.selected_item]
extends = "$editor.autocomplete.item"
background = "$state.selected"
[editor.autocomplete.hovered_item]
extends = "$editor.autocomplete.item"
background = "$state.hover"
[project_diagnostics]
background = "$surface.1"
empty_message = { extends = "$text.0", size = 18 }
status_bar_item = { extends = "$text.2", margin.right = 10 }
tab_icon_width = 13
tab_icon_spacing = 4
tab_summary_spacing = 10
[search]
match_background = "$state.highlighted_line"
results_status = { extends = "$text.0", size = 18 }
tab_icon_width = 14
tab_icon_spacing = 4
[search.option_button]
extends = "$text.1"
padding = { left = 6, right = 6, top = 1, bottom = 1 }
corner_radius = 6
background = "$surface.1"
border = { width = 1, color = "$border.0" }
margin.left = 1
margin.right = 1
[search.option_button_group]
padding = { left = 2, right = 2 }
[search.active_option_button]
extends = "$search.option_button"
background = "$surface.2"
[search.hovered_option_button]
extends = "$search.option_button"
background = "$surface.2"
[search.active_hovered_option_button]
extends = "$search.option_button"
background = "$surface.2"
[search.match_index]
extends = "$text.2"
padding = 6
[search.editor]
min_width = 200
max_width = 500
background = "$surface.0"
corner_radius = 6
padding = { left = 14, right = 14, top = 3, bottom = 3 }
margin = { right = 5 }
text = "$text.0"
placeholder_text = "$text.2"
selection = "$selection.host"
border = { width = 1, color = "$border.0" }
[search.invalid_editor]
extends = "$search.editor"
border = { width = 1, color = "$status.bad" }
-67
View File
@@ -1,67 +0,0 @@
extends = "_base"
[surface]
0 = "#222222"
1 = "#0f0b0c"
2 = "#131415"
[border]
0 = "#000000B2"
1 = "#FFFFFF20"
[text]
0 = { extends = "$text.base", color = "#ffffff" }
1 = { extends = "$text.base", color = "#b3b3b3" }
2 = { extends = "$text.base", color = "#7b7d80" }
3 = { extends = "$text.base", color = "#66686A" }
[shadow]
0 = "#00000052"
[selection]
host = { selection = "#3B57BC55", cursor = "$text.0.color" }
guests = [
{ selection = "#FDF35133", cursor = "#FDF351" },
{ selection = "#4EACAD33", cursor = "#4EACAD" },
{ selection = "#D0453B33", cursor = "#D0453B" },
{ selection = "#3B874B33", cursor = "#3B874B" },
{ selection = "#BD7CB433", cursor = "#BD7CB4" },
{ selection = "#EE823133", cursor = "#EE8231" },
{ selection = "#5A2B9233", cursor = "#5A2B92" },
]
[status]
good = "#4fac63"
info = "#3c5dd4"
warn = "#faca50"
bad = "#b7372e"
[state]
active_line = "#161313"
highlighted_line = "#faca5033"
deleted_line = "#dd000036"
inserted_line = "#00dd0036"
hover = "#00000033"
selected = "#00000088"
[editor.syntax]
keyword = { color = "#0086c0", weight = "bold" }
function = "#dcdcaa"
string = "#cb8f77"
type = "#4ec9b0"
number = "#b5cea8"
comment = "#6a9955"
property = "#4e94ce"
variant = "#4fc1ff"
constant = "#9cdcfe"
title = { color = "#9cdcfe", weight = "bold" }
emphasis = "#4ec9b0"
"emphasis.strong" = { color = "#4ec9b0", weight = "bold" }
link_uri = { color = "#6a9955", underline = true }
link_text = { color = "#cb8f77", italic = true }
list_marker = "#4e94ce"
[workspace.disconnected_overlay]
extends = "$text.base"
color = "#ffffff"
background = "#000000aa"
File diff suppressed because it is too large Load Diff
-67
View File
@@ -1,67 +0,0 @@
extends = "_base"
[surface]
0 = "#283340"
1 = "#1C2733"
2 = "#1C2733"
[border]
0 = "#1B222B"
1 = "#FFFFFF20"
[text]
0 = { extends = "$text.base", color = "#FFFFFF" }
1 = { extends = "$text.base", color = "#CDD1E2" }
2 = { extends = "$text.base", color = "#9BA8BE" }
3 = { extends = "$text.base", color = "#6E7483" }
[shadow]
0 = "#00000052"
[selection]
host = { selection = "#3B57BC55", cursor = "$text.0.color" }
guests = [
{ selection = "#FDF35133", cursor = "#FDF351" },
{ selection = "#4EACAD33", cursor = "#4EACAD" },
{ selection = "#D0453B33", cursor = "#D0453B" },
{ selection = "#3B874B33", cursor = "#3B874B" },
{ selection = "#BD7CB433", cursor = "#BD7CB4" },
{ selection = "#EE823133", cursor = "#EE8231" },
{ selection = "#5A2B9233", cursor = "#5A2B92" },
]
[status]
good = "#4fac63"
info = "#3c5dd4"
warn = "#faca50"
bad = "#b7372e"
[state]
active_line = "#00000022"
highlighted_line = "#faca5033"
deleted_line = "#dd000036"
inserted_line = "#00dd0036"
hover = "#00000033"
selected = "#00000088"
[editor.syntax]
keyword = { color = "#0086c0", weight = "bold" }
function = "#dcdcaa"
string = "#cb8f77"
type = "#4ec9b0"
number = "#b5cea8"
comment = "#6a9955"
property = "#4e94ce"
variant = "#4fc1ff"
constant = "#9cdcfe"
title = { color = "#9cdcfe", weight = "bold" }
emphasis = "#4ec9b0"
"emphasis.strong" = { color = "#4ec9b0", weight = "bold" }
link_uri = { color = "#6a9955", underline = true }
link_text = { color = "#cb8f77", italic = true }
list_marker = "#4e94ce"
[workspace.disconnected_overlay]
extends = "$text.base"
color = "#ffffff"
background = "#000000aa"
File diff suppressed because it is too large Load Diff
-67
View File
@@ -1,67 +0,0 @@
extends = "_base"
[surface]
0 = "#EAEAEB"
1 = "#FAFAFA"
2 = "#FFFFFF"
[border]
0 = "#DDDDDC"
1 = "#0000000F"
[text]
0 = { extends = "$text.base", color = "#000000" }
1 = { extends = "$text.base", color = "#29292B" }
2 = { extends = "$text.base", color = "#7E7E83" }
3 = { extends = "$text.base", color = "#939393" }
[shadow]
0 = "#0000000D"
[selection]
host = { selection = "#3B57BC55", cursor = "$text.0.color" }
guests = [
{ selection = "#D0453B33", cursor = "#D0453B" },
{ selection = "#3B874B33", cursor = "#3B874B" },
{ selection = "#BD7CB433", cursor = "#BD7CB4" },
{ selection = "#EE823133", cursor = "#EE8231" },
{ selection = "#5A2B9233", cursor = "#5A2B92" },
{ selection = "#FDF35133", cursor = "#FDF351" },
{ selection = "#4EACAD33", cursor = "#4EACAD" },
]
[status]
good = "#4fac63"
info = "#3c5dd4"
warn = "#faca50"
bad = "#b7372e"
[state]
active_line = "#00000008"
highlighted_line = "#faca5033"
deleted_line = "#dd000036"
inserted_line = "#00dd0036"
hover = "#0000000D"
selected = "#0000001c"
[editor.syntax]
keyword = { color = "#0000fa", weight = "bold" }
function = "#795e26"
string = "#a82121"
type = "#267f29"
number = "#b5cea8"
comment = "#6a9955"
property = "#4e94ce"
variant = "#4fc1ff"
constant = "#5a9ccc"
title = { color = "#5a9ccc", weight = "bold" }
emphasis = "#267f29"
"emphasis.strong" = { color = "#267f29", weight = "bold" }
link_uri = { color = "#6a9955", underline = true }
link_text = { color = "#a82121", italic = true }
list_marker = "#4e94ce"
[workspace.disconnected_overlay]
extends = "$text.base"
color = "#ffffff"
background = "#000000cc"
+2 -1
View File
@@ -988,7 +988,8 @@ mod tests {
lazy_static::lazy_static! {
static ref DEFAULT_THEME: parking_lot::Mutex<Option<Arc<Theme>>> = Default::default();
static ref FONTS: Vec<Arc<Vec<u8>>> = vec![
Assets.load("fonts/zed-sans/zed-sans-extended.ttf").unwrap().to_vec().into()
Assets.load("fonts/zed-sans/zed-sans-extended.ttf").unwrap().to_vec().into(),
Assets.load("fonts/zed-mono/zed-mono-extended.ttf").unwrap().to_vec().into(),
];
}