WIP snake_case 2/?

This commit is contained in:
Nate Butler
2023-06-29 01:48:40 -04:00
parent b015f506da
commit ba17fae8d9
23 changed files with 317 additions and 356 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import {
fontFamilies as font_families,
fontSizes as font_sizes,
font_families,
font_sizes,
FontWeight,
} from "../common"
import { Layer, Styles, StyleSets, Style } from "../theme/color_scheme"
+4 -5
View File
@@ -1,14 +1,13 @@
import { ColorScheme } from "../theme/color_scheme"
import { background, border } from "./components"
export default function contacts_popover(colorScheme: ColorScheme): any {
const layer = colorScheme.middle
export default function contacts_popover(theme: ColorScheme): any {
return {
background: background(layer),
background: background(theme.middle),
corner_radius: 6,
padding: { top: 6, bottom: 6 },
shadow: colorScheme.popoverShadow,
border: border(layer),
shadow: theme.popoverShadow,
border: border(theme.middle),
width: 300,
height: 400,
}
+16 -17
View File
@@ -2,25 +2,24 @@ import { ColorScheme } from "../theme/color_scheme"
import { background, border, border_color, text } from "./components"
import { interactive, toggleable } from "../element"
export default function context_menu(colorScheme: ColorScheme): any {
const layer = colorScheme.middle
export default function context_menu(theme: ColorScheme): any {
return {
background: background(layer),
background: background(theme.middle),
corner_radius: 10,
padding: 4,
shadow: colorScheme.popoverShadow,
border: border(layer),
keystrokeMargin: 30,
shadow: theme.popoverShadow,
border: border(theme.middle),
keystroke_margin: 30,
item: toggleable({
base: interactive({
base: {
iconSpacing: 8,
icon_spacing: 8,
icon_width: 14,
padding: { left: 6, right: 6, top: 2, bottom: 2 },
corner_radius: 6,
label: text(layer, "sans", { size: "sm" }),
label: text(theme.middle, "sans", { size: "sm" }),
keystroke: {
...text(layer, "sans", "variant", {
...text(theme.middle, "sans", "variant", {
size: "sm",
weight: "bold",
}),
@@ -29,10 +28,10 @@ export default function context_menu(colorScheme: ColorScheme): any {
},
state: {
hovered: {
background: background(layer, "hovered"),
label: text(layer, "sans", "hovered", { size: "sm" }),
background: background(theme.middle, "hovered"),
label: text(theme.middle, "sans", "hovered", { size: "sm" }),
keystroke: {
...text(layer, "sans", "hovered", {
...text(theme.middle, "sans", "hovered", {
size: "sm",
weight: "bold",
}),
@@ -40,27 +39,27 @@ export default function context_menu(colorScheme: ColorScheme): any {
},
},
clicked: {
background: background(layer, "pressed"),
background: background(theme.middle, "pressed"),
},
},
}),
state: {
active: {
default: {
background: background(layer, "active"),
background: background(theme.middle, "active"),
},
hovered: {
background: background(layer, "hovered"),
background: background(theme.middle, "hovered"),
},
clicked: {
background: background(layer, "pressed"),
background: background(theme.middle, "pressed"),
},
},
},
}),
separator: {
background: border_color(layer),
background: border_color(theme.middle),
margin: { top: 2, bottom: 2 },
},
}
+41 -42
View File
@@ -1,17 +1,16 @@
import { ColorScheme } from "../theme/color_scheme"
import { background, border, foreground, svg, text } from "./components"
import { interactive } from "../element"
export default function copilot(colorScheme: ColorScheme): any {
const layer = colorScheme.middle
export default function copilot(theme: ColorScheme): any {
const content_width = 264
const ctaButton =
const cta_button =
// Copied from welcome screen. FIXME: Move this into a ZDS component
interactive({
base: {
background: background(layer),
border: border(layer, "default"),
background: background(theme.middle),
border: border(theme.middle, "default"),
corner_radius: 4,
margin: {
top: 4,
@@ -25,22 +24,22 @@ export default function copilot(colorScheme: ColorScheme): any {
left: 7,
right: 7,
},
...text(layer, "sans", "default", { size: "sm" }),
...text(theme.middle, "sans", "default", { size: "sm" }),
},
state: {
hovered: {
...text(layer, "sans", "default", { size: "sm" }),
background: background(layer, "hovered"),
border: border(layer, "active"),
...text(theme.middle, "sans", "default", { size: "sm" }),
background: background(theme.middle, "hovered"),
border: border(theme.middle, "active"),
},
},
})
return {
outLinkIcon: interactive({
out_link_icon: interactive({
base: {
icon: svg(
foreground(layer, "variant"),
foreground(theme.middle, "variant"),
"icons/link_out_12.svg",
12,
12
@@ -53,21 +52,21 @@ export default function copilot(colorScheme: ColorScheme): any {
state: {
hovered: {
icon: {
color: foreground(layer, "hovered"),
color: foreground(theme.middle, "hovered"),
},
},
},
}),
modal: {
titleText: {
title_text: {
default: {
...text(layer, "sans", { size: "xs", weight: "bold" }),
...text(theme.middle, "sans", { size: "xs", weight: "bold" }),
},
},
titlebar: {
background: background(colorScheme.lowest),
border: border(layer, "active"),
background: background(theme.lowest),
border: border(theme.middle, "active"),
padding: {
top: 4,
bottom: 4,
@@ -76,7 +75,7 @@ export default function copilot(colorScheme: ColorScheme): any {
},
},
container: {
background: background(colorScheme.lowest),
background: background(theme.lowest),
padding: {
top: 0,
left: 0,
@@ -84,10 +83,10 @@ export default function copilot(colorScheme: ColorScheme): any {
bottom: 8,
},
},
closeIcon: interactive({
close_icon: interactive({
base: {
icon: svg(
foreground(layer, "variant"),
foreground(theme.middle, "variant"),
"icons/x_mark_8.svg",
8,
8
@@ -108,7 +107,7 @@ export default function copilot(colorScheme: ColorScheme): any {
state: {
hovered: {
icon: svg(
foreground(layer, "on"),
foreground(theme.middle, "on"),
"icons/x_mark_8.svg",
8,
8
@@ -116,7 +115,7 @@ export default function copilot(colorScheme: ColorScheme): any {
},
clicked: {
icon: svg(
foreground(layer, "base"),
foreground(theme.middle, "base"),
"icons/x_mark_8.svg",
8,
8
@@ -133,11 +132,11 @@ export default function copilot(colorScheme: ColorScheme): any {
auth: {
content_width,
ctaButton,
cta_button,
header: {
icon: svg(
foreground(layer, "default"),
foreground(theme.middle, "default"),
"icons/zed_plus_copilot_32.svg",
92,
32
@@ -154,7 +153,7 @@ export default function copilot(colorScheme: ColorScheme): any {
prompting: {
subheading: {
...text(layer, "sans", { size: "xs" }),
...text(theme.middle, "sans", { size: "xs" }),
margin: {
top: 6,
bottom: 12,
@@ -164,19 +163,19 @@ export default function copilot(colorScheme: ColorScheme): any {
},
hint: {
...text(layer, "sans", { size: "xs", color: "#838994" }),
...text(theme.middle, "sans", { size: "xs", color: "#838994" }),
margin: {
top: 6,
bottom: 2,
},
},
deviceCode: {
text: text(layer, "mono", { size: "sm" }),
device_code: {
text: text(theme.middle, "mono", { size: "sm" }),
cta: {
...ctaButton,
background: background(colorScheme.lowest),
border: border(colorScheme.lowest, "inverted"),
...cta_button,
background: background(theme.lowest),
border: border(theme.lowest, "inverted"),
padding: {
top: 0,
bottom: 0,
@@ -189,7 +188,7 @@ export default function copilot(colorScheme: ColorScheme): any {
},
},
left: content_width / 2,
leftContainer: {
left_container: {
padding: {
top: 3,
bottom: 3,
@@ -198,9 +197,9 @@ export default function copilot(colorScheme: ColorScheme): any {
},
},
right: (content_width * 1) / 3,
rightContainer: interactive({
right_container: interactive({
base: {
border: border(colorScheme.lowest, "inverted", {
border: border(theme.lowest, "inverted", {
bottom: false,
right: false,
top: false,
@@ -215,7 +214,7 @@ export default function copilot(colorScheme: ColorScheme): any {
},
state: {
hovered: {
border: border(layer, "active", {
border: border(theme.middle, "active", {
bottom: false,
right: false,
top: false,
@@ -227,9 +226,9 @@ export default function copilot(colorScheme: ColorScheme): any {
},
},
notAuthorized: {
not_authorized: {
subheading: {
...text(layer, "sans", { size: "xs" }),
...text(theme.middle, "sans", { size: "xs" }),
margin: {
top: 16,
@@ -240,12 +239,12 @@ export default function copilot(colorScheme: ColorScheme): any {
},
warning: {
...text(layer, "sans", {
...text(theme.middle, "sans", {
size: "xs",
color: foreground(layer, "warning"),
color: foreground(theme.middle, "warning"),
}),
border: border(layer, "warning"),
background: background(layer, "warning"),
border: border(theme.middle, "warning"),
background: background(theme.middle, "warning"),
corner_radius: 2,
padding: {
top: 4,
@@ -263,7 +262,7 @@ export default function copilot(colorScheme: ColorScheme): any {
authorized: {
subheading: {
...text(layer, "sans", { size: "xs" }),
...text(theme.middle, "sans", { size: "xs" }),
margin: {
top: 16,
@@ -272,7 +271,7 @@ export default function copilot(colorScheme: ColorScheme): any {
},
hint: {
...text(layer, "sans", { size: "xs", color: "#838994" }),
...text(theme.middle, "sans", { size: "xs", color: "#838994" }),
margin: {
top: 24,
bottom: 4,
+75 -75
View File
@@ -7,17 +7,17 @@ import {
foreground,
text,
} from "./components"
import hoverPopover from "./hover_popover"
import hover_popover from "./hover_popover"
import { buildSyntax } from "../theme/syntax"
import { build_syntax } from "../theme/syntax"
import { interactive, toggleable } from "../element"
export default function editor(colorScheme: ColorScheme): any {
const { is_light } = colorScheme
export default function editor(theme: ColorScheme): any {
const { is_light } = theme
const layer = colorScheme.highest
const layer = theme.highest
const autocompleteItem = {
const autocomplete_item = {
corner_radius: 6,
padding: {
bottom: 2,
@@ -29,7 +29,7 @@ export default function editor(colorScheme: ColorScheme): any {
function diagnostic(layer: Layer, styleSet: StyleSets) {
return {
textScaleFactor: 0.857,
text_scale_factor: 0.857,
header: {
border: border(layer, {
top: true,
@@ -37,7 +37,7 @@ export default function editor(colorScheme: ColorScheme): any {
},
message: {
text: text(layer, "sans", styleSet, "default", { size: "sm" }),
highlightText: text(layer, "sans", styleSet, "default", {
highlight_text: text(layer, "sans", styleSet, "default", {
size: "sm",
weight: "bold",
}),
@@ -45,16 +45,16 @@ export default function editor(colorScheme: ColorScheme): any {
}
}
const syntax = buildSyntax(colorScheme)
const syntax = build_syntax(theme)
return {
textColor: syntax.primary.color,
text_color: syntax.primary.color,
background: background(layer),
activeLineBackground: withOpacity(background(layer, "on"), 0.75),
highlightedLineBackground: background(layer, "on"),
active_line_background: withOpacity(background(layer, "on"), 0.75),
highlighted_line_background: background(layer, "on"),
// Inline autocomplete suggestions, Co-pilot suggestions, etc.
suggestion: syntax.predictive,
codeActions: {
code_actions: {
indicator: toggleable({
base: interactive({
base: {
@@ -84,12 +84,12 @@ export default function editor(colorScheme: ColorScheme): any {
},
}),
verticalScale: 0.55,
vertical_scale: 0.55,
},
folds: {
iconMarginScale: 2.5,
foldedIcon: "icons/chevron_right_8.svg",
foldableIcon: "icons/chevron_down_8.svg",
icon_margin_scale: 2.5,
folded_icon: "icons/chevron_right_8.svg",
foldable_icon: "icons/chevron_down_8.svg",
indicator: toggleable({
base: interactive({
base: {
@@ -116,20 +116,20 @@ export default function editor(colorScheme: ColorScheme): any {
},
}),
ellipses: {
textColor: colorScheme.ramps.neutral(0.71).hex(),
corner_radiusFactor: 0.15,
text_color: theme.ramps.neutral(0.71).hex(),
corner_radius_factor: 0.15,
background: {
// Copied from hover_popover highlight
default: {
color: colorScheme.ramps.neutral(0.5).alpha(0.0).hex(),
color: theme.ramps.neutral(0.5).alpha(0.0).hex(),
},
hovered: {
color: colorScheme.ramps.neutral(0.5).alpha(0.5).hex(),
color: theme.ramps.neutral(0.5).alpha(0.5).hex(),
},
clicked: {
color: colorScheme.ramps.neutral(0.5).alpha(0.7).hex(),
color: theme.ramps.neutral(0.5).alpha(0.7).hex(),
},
},
},
@@ -137,14 +137,14 @@ export default function editor(colorScheme: ColorScheme): any {
},
diff: {
deleted: is_light
? colorScheme.ramps.red(0.5).hex()
: colorScheme.ramps.red(0.4).hex(),
? theme.ramps.red(0.5).hex()
: theme.ramps.red(0.4).hex(),
modified: is_light
? colorScheme.ramps.yellow(0.5).hex()
: colorScheme.ramps.yellow(0.5).hex(),
? theme.ramps.yellow(0.5).hex()
: theme.ramps.yellow(0.5).hex(),
inserted: is_light
? colorScheme.ramps.green(0.4).hex()
: colorScheme.ramps.green(0.5).hex(),
? theme.ramps.green(0.4).hex()
: theme.ramps.green(0.5).hex(),
removedWidthEm: 0.275,
widthEm: 0.15,
corner_radius: 0.05,
@@ -156,7 +156,7 @@ export default function editor(colorScheme: ColorScheme): any {
foreground(layer, "accent"),
0.1
),
documentHighlightWriteBackground: colorScheme.ramps
documentHighlightWriteBackground: theme.ramps
.neutral(0.5)
.alpha(0.4)
.hex(), // TODO: This was blend * 2
@@ -167,98 +167,98 @@ export default function editor(colorScheme: ColorScheme): any {
lineNumberActive: foreground(layer),
renameFade: 0.6,
unnecessaryCodeFade: 0.5,
selection: colorScheme.players[0],
whitespace: colorScheme.ramps.neutral(0.5).hex(),
selection: theme.players[0],
whitespace: theme.ramps.neutral(0.5).hex(),
guestSelections: [
colorScheme.players[1],
colorScheme.players[2],
colorScheme.players[3],
colorScheme.players[4],
colorScheme.players[5],
colorScheme.players[6],
colorScheme.players[7],
theme.players[1],
theme.players[2],
theme.players[3],
theme.players[4],
theme.players[5],
theme.players[6],
theme.players[7],
],
autocomplete: {
background: background(colorScheme.middle),
background: background(theme.middle),
corner_radius: 8,
padding: 4,
margin: {
left: -14,
},
border: border(colorScheme.middle),
shadow: colorScheme.popoverShadow,
matchHighlight: foreground(colorScheme.middle, "accent"),
item: autocompleteItem,
border: border(theme.middle),
shadow: theme.popoverShadow,
matchHighlight: foreground(theme.middle, "accent"),
item: autocomplete_item,
hoveredItem: {
...autocompleteItem,
...autocomplete_item,
matchHighlight: foreground(
colorScheme.middle,
theme.middle,
"accent",
"hovered"
),
background: background(colorScheme.middle, "hovered"),
background: background(theme.middle, "hovered"),
},
selectedItem: {
...autocompleteItem,
...autocomplete_item,
matchHighlight: foreground(
colorScheme.middle,
theme.middle,
"accent",
"active"
),
background: background(colorScheme.middle, "active"),
background: background(theme.middle, "active"),
},
},
diagnosticHeader: {
background: background(colorScheme.middle),
background: background(theme.middle),
icon_widthFactor: 1.5,
textScaleFactor: 0.857,
border: border(colorScheme.middle, {
border: border(theme.middle, {
bottom: true,
top: true,
}),
code: {
...text(colorScheme.middle, "mono", { size: "sm" }),
...text(theme.middle, "mono", { size: "sm" }),
margin: {
left: 10,
},
},
source: {
text: text(colorScheme.middle, "sans", {
text: text(theme.middle, "sans", {
size: "sm",
weight: "bold",
}),
},
message: {
highlightText: text(colorScheme.middle, "sans", {
highlightText: text(theme.middle, "sans", {
size: "sm",
weight: "bold",
}),
text: text(colorScheme.middle, "sans", { size: "sm" }),
text: text(theme.middle, "sans", { size: "sm" }),
},
},
diagnosticPathHeader: {
background: background(colorScheme.middle),
background: background(theme.middle),
textScaleFactor: 0.857,
filename: text(colorScheme.middle, "mono", { size: "sm" }),
filename: text(theme.middle, "mono", { size: "sm" }),
path: {
...text(colorScheme.middle, "mono", { size: "sm" }),
...text(theme.middle, "mono", { size: "sm" }),
margin: {
left: 12,
},
},
},
errorDiagnostic: diagnostic(colorScheme.middle, "negative"),
warningDiagnostic: diagnostic(colorScheme.middle, "warning"),
informationDiagnostic: diagnostic(colorScheme.middle, "accent"),
hintDiagnostic: diagnostic(colorScheme.middle, "warning"),
invalidErrorDiagnostic: diagnostic(colorScheme.middle, "base"),
invalidHintDiagnostic: diagnostic(colorScheme.middle, "base"),
invalidInformationDiagnostic: diagnostic(colorScheme.middle, "base"),
invalidWarningDiagnostic: diagnostic(colorScheme.middle, "base"),
hoverPopover: hoverPopover(colorScheme),
errorDiagnostic: diagnostic(theme.middle, "negative"),
warningDiagnostic: diagnostic(theme.middle, "warning"),
informationDiagnostic: diagnostic(theme.middle, "accent"),
hintDiagnostic: diagnostic(theme.middle, "warning"),
invalidErrorDiagnostic: diagnostic(theme.middle, "base"),
invalidHintDiagnostic: diagnostic(theme.middle, "base"),
invalidInformationDiagnostic: diagnostic(theme.middle, "base"),
invalidWarningDiagnostic: diagnostic(theme.middle, "base"),
hover_popover: hover_popover(theme),
linkDefinition: {
color: syntax.linkUri.color,
underline: syntax.linkUri.underline,
color: syntax.link_uri.color,
underline: syntax.link_uri.underline,
},
jumpIcon: interactive({
base: {
@@ -299,14 +299,14 @@ export default function editor(colorScheme: ColorScheme): any {
},
git: {
deleted: is_light
? withOpacity(colorScheme.ramps.red(0.5).hex(), 0.8)
: withOpacity(colorScheme.ramps.red(0.4).hex(), 0.8),
? withOpacity(theme.ramps.red(0.5).hex(), 0.8)
: withOpacity(theme.ramps.red(0.4).hex(), 0.8),
modified: is_light
? withOpacity(colorScheme.ramps.yellow(0.5).hex(), 0.8)
: withOpacity(colorScheme.ramps.yellow(0.4).hex(), 0.8),
? withOpacity(theme.ramps.yellow(0.5).hex(), 0.8)
: withOpacity(theme.ramps.yellow(0.4).hex(), 0.8),
inserted: is_light
? withOpacity(colorScheme.ramps.green(0.5).hex(), 0.8)
: withOpacity(colorScheme.ramps.green(0.4).hex(), 0.8),
? withOpacity(theme.ramps.green(0.5).hex(), 0.8)
: withOpacity(theme.ramps.green(0.4).hex(), 0.8),
},
},
compositionMark: {
@@ -39,14 +39,14 @@ export default function incoming_call_notification(
border: border(layer, { left: true, bottom: true }),
...text(layer, "sans", "positive", {
size: "xs",
weight: "extra_bold",
weight: "bold",
}),
},
declineButton: {
border: border(layer, { left: true }),
...text(layer, "sans", "negative", {
size: "xs",
weight: "extra_bold",
weight: "bold",
}),
},
}
+1 -1
View File
@@ -48,7 +48,7 @@ export default function project_panel(theme: ColorScheme): any {
background: background(layer),
iconColor: foreground(layer, "variant"),
iconSize: 7,
iconSpacing: 5,
icon_spacing: 5,
text: text(layer, "mono", "variant", { size: "sm" }),
status: {
...git_status,
@@ -40,14 +40,14 @@ export default function project_shared_notification(
border: border(layer, { left: true, bottom: true }),
...text(layer, "sans", "accent", {
size: "xs",
weight: "extra_bold",
weight: "bold",
}),
},
dismissButton: {
border: border(layer, { left: true }),
...text(layer, "sans", "variant", {
size: "xs",
weight: "extra_bold",
weight: "bold",
}),
},
}
+2 -2
View File
@@ -41,7 +41,7 @@ export default function status_bar(colorScheme: ColorScheme): any {
lspStatus: interactive({
base: {
...diagnosticStatusContainer,
iconSpacing: 4,
icon_spacing: 4,
icon_width: 14,
height: 18,
message: text(layer, "sans"),
@@ -65,7 +65,7 @@ export default function status_bar(colorScheme: ColorScheme): any {
base: {
height: 20,
icon_width: 16,
iconSpacing: 2,
icon_spacing: 2,
summarySpacing: 6,
text: text(layer, "sans", { size: "sm" }),
iconColorOk: foreground(layer, "variant"),