| @@ -1,4 +1,4 @@ |
| 1 | | −use gpui2::{hsla, Rgba}; |
| 1 | +use gpui2::{hsla, Hsla, Rgba}; |
| 2 | 2 | |
| 3 | 3 | use crate::{ |
| 4 | 4 | colors::{GitStatusColors, PlayerColor, PlayerColors, StatusColors, SystemColors, ThemeColors}, |
| @@ -6,6 +6,10 @@ use crate::{ · 1 unmodified line |
| 6 | 6 | syntax::SyntaxTheme, |
| 7 | 7 | }; |
| 8 | 8 | |
| 9 | +fn neutral() -> DefaultColorScaleSet { |
| 10 | + slate() |
| 11 | +} |
| 12 | + |
| 9 | 13 | impl Default for SystemColors { |
| 10 | 14 | fn default() -> Self { |
| 11 | 15 | Self { |
| @@ -20,17 +24,17 @@ impl Default for SystemColors { · 8 unmodified lines |
| 20 | 24 | impl Default for StatusColors { |
| 21 | 25 | fn default() -> Self { |
| 22 | 26 | Self { |
| 23 | | − conflict: gpui2::black(), |
| 24 | | − created: gpui2::black(), |
| 25 | | − deleted: gpui2::black(), |
| 26 | | − error: gpui2::black(), |
| 27 | | − hidden: gpui2::black(), |
| 28 | | − ignored: gpui2::black(), |
| 29 | | − info: gpui2::black(), |
| 30 | | − modified: gpui2::black(), |
| 31 | | − renamed: gpui2::black(), |
| 32 | | − success: gpui2::black(), |
| 33 | | − warning: gpui2::black(), |
| 27 | + conflict: red().dark(11).into(), |
| 28 | + created: green().dark(11).into(), |
| 29 | + deleted: red().dark(11).into(), |
| 30 | + error: red().dark(11).into(), |
| 31 | + hidden: neutral().dark(11).into(), |
| 32 | + ignored: neutral().dark(11).into(), |
| 33 | + info: blue().dark(11).into(), |
| 34 | + modified: yellow().dark(11).into(), |
| 35 | + renamed: blue().dark(11).into(), |
| 36 | + success: green().dark(11).into(), |
| 37 | + warning: yellow().dark(11).into(), |
| 34 | 38 | } |
| 35 | 39 | } |
| 36 | 40 | } |
| @@ -38,12 +42,12 @@ impl Default for StatusColors { · 1 unmodified line |
| 38 | 42 | impl Default for GitStatusColors { |
| 39 | 43 | fn default() -> Self { |
| 40 | 44 | Self { |
| 41 | | − conflict: gpui2::rgba(0xdec184ff).into(), |
| 42 | | − created: gpui2::rgba(0xa1c181ff).into(), |
| 43 | | − deleted: gpui2::rgba(0xd07277ff).into(), |
| 44 | | − ignored: gpui2::rgba(0x555a63ff).into(), |
| 45 | | − modified: gpui2::rgba(0x74ade8ff).into(), |
| 46 | | − renamed: gpui2::rgba(0xdec184ff).into(), |
| 45 | + conflict: orange().dark(11), |
| 46 | + created: green().dark(11), |
| 47 | + deleted: red().dark(11), |
| 48 | + ignored: green().dark(11), |
| 49 | + modified: yellow().dark(11), |
| 50 | + renamed: blue().dark(11), |
| 47 | 51 | } |
| 48 | 52 | } |
| 49 | 53 | } |
| @@ -189,82 +193,86 @@ impl SyntaxTheme { · 139 unmodified lines |
| 189 | 193 | |
| 190 | 194 | impl ThemeColors { |
| 191 | 195 | pub fn default_light() -> Self { |
| 196 | + let system = SystemColors::default(); |
| 197 | + |
| 192 | 198 | Self { |
| 193 | | − border: gpui2::white(), |
| 194 | | − border_variant: gpui2::white(), |
| 195 | | − border_focused: gpui2::white(), |
| 196 | | − border_transparent: gpui2::white(), |
| 197 | | − elevated_surface: gpui2::white(), |
| 198 | | − surface: gpui2::white(), |
| 199 | | − background: gpui2::white(), |
| 200 | | − element: gpui2::white(), |
| 201 | | − element_hover: gpui2::white(), |
| 202 | | − element_active: gpui2::white(), |
| 203 | | − element_selected: gpui2::white(), |
| 204 | | − element_disabled: gpui2::white(), |
| 205 | | − element_placeholder: gpui2::white(), |
| 206 | | − ghost_element: gpui2::white(), |
| 207 | | − ghost_element_hover: gpui2::white(), |
| 208 | | − ghost_element_active: gpui2::white(), |
| 209 | | − ghost_element_selected: gpui2::white(), |
| 210 | | − ghost_element_disabled: gpui2::white(), |
| 211 | | − text: gpui2::white(), |
| 212 | | − text_muted: gpui2::white(), |
| 213 | | − text_placeholder: gpui2::white(), |
| 214 | | − text_disabled: gpui2::white(), |
| 215 | | − text_accent: gpui2::white(), |
| 216 | | − icon: gpui2::white(), |
| 217 | | − icon_muted: gpui2::white(), |
| 218 | | − icon_disabled: gpui2::white(), |
| 219 | | − icon_placeholder: gpui2::white(), |
| 220 | | − icon_accent: gpui2::white(), |
| 221 | | − status_bar: gpui2::white(), |
| 222 | | − title_bar: gpui2::white(), |
| 223 | | − toolbar: gpui2::white(), |
| 224 | | − tab_bar: gpui2::white(), |
| 225 | | − editor: gpui2::white(), |
| 226 | | − editor_subheader: gpui2::white(), |
| 227 | | − editor_active_line: gpui2::white(), |
| 199 | + border: neutral().light(6).into(), |
| 200 | + border_variant: neutral().light(5).into(), |
| 201 | + border_focused: blue().light(5).into(), |
| 202 | + border_transparent: system.transparent, |
| 203 | + elevated_surface: neutral().light(2).into(), |
| 204 | + surface: neutral().light(2).into(), |
| 205 | + background: neutral().light(1).into(), |
| 206 | + element: neutral().light(3).into(), |
| 207 | + element_hover: neutral().light(4).into(), |
| 208 | + element_active: neutral().light(5).into(), |
| 209 | + element_selected: neutral().light(5).into(), |
| 210 | + element_disabled: neutral().light_alpha(3).into(), |
| 211 | + element_placeholder: neutral().light(11).into(), |
| 212 | + ghost_element: system.transparent, |
| 213 | + ghost_element_hover: neutral().light(4).into(), |
| 214 | + ghost_element_active: neutral().light(5).into(), |
| 215 | + ghost_element_selected: neutral().light(5).into(), |
| 216 | + ghost_element_disabled: neutral().light_alpha(3).into(), |
| 217 | + text: neutral().light(12).into(), |
| 218 | + text_muted: neutral().light(11).into(), |
| 219 | + text_placeholder: neutral().light(11).into(), |
| 220 | + text_disabled: neutral().light(10).into(), |
| 221 | + text_accent: blue().light(12).into(), |
| 222 | + icon: neutral().light(12).into(), |
| 223 | + icon_muted: neutral().light(11).into(), |
| 224 | + icon_disabled: neutral().light(10).into(), |
| 225 | + icon_placeholder: neutral().light(11).into(), |
| 226 | + icon_accent: blue().light(12).into(), |
| 227 | + status_bar: neutral().light(2).into(), |
| 228 | + title_bar: neutral().light(2).into(), |
| 229 | + toolbar: neutral().light(2).into(), |
| 230 | + tab_bar: neutral().light(2).into(), |
| 231 | + editor: neutral().light(1).into(), |
| 232 | + editor_subheader: neutral().light(2).into(), |
| 233 | + editor_active_line: neutral().light_alpha(3).into(), |
| 228 | 234 | } |
| 229 | 235 | } |
| 230 | 236 | |
| 231 | 237 | pub fn default_dark() -> Self { |
| 238 | + let system = SystemColors::default(); |
| 239 | + |
| 232 | 240 | Self { |
| 233 | | − border: gpui2::rgba(0x464b57ff).into(), |
| 234 | | − border_variant: gpui2::rgba(0x464b57ff).into(), |
| 235 | | − border_focused: gpui2::rgba(0x293b5bff).into(), |
| 236 | | − border_transparent: gpui2::rgba(0x00000000).into(), |
| 237 | | − elevated_surface: gpui2::rgba(0x3b414dff).into(), |
| 238 | | − surface: gpui2::rgba(0x2f343eff).into(), |
| 239 | | − background: gpui2::rgba(0x3b414dff).into(), |
| 240 | | − element: gpui2::rgba(0x3b414dff).into(), |
| 241 | | − element_hover: gpui2::rgba(0xffffff1e).into(), |
| 242 | | − element_active: gpui2::rgba(0xffffff28).into(), |
| 243 | | − element_selected: gpui2::rgba(0x18243dff).into(), |
| 244 | | − element_disabled: gpui2::rgba(0x00000000).into(), |
| 245 | | − element_placeholder: gpui2::black(), |
| 246 | | − ghost_element: gpui2::rgba(0x00000000).into(), |
| 247 | | − ghost_element_hover: gpui2::rgba(0xffffff14).into(), |
| 248 | | − ghost_element_active: gpui2::rgba(0xffffff1e).into(), |
| 249 | | − ghost_element_selected: gpui2::rgba(0x18243dff).into(), |
| 250 | | − ghost_element_disabled: gpui2::rgba(0x00000000).into(), |
| 251 | | − text: gpui2::rgba(0xc8ccd4ff).into(), |
| 252 | | − text_muted: gpui2::rgba(0x838994ff).into(), |
| 253 | | − text_placeholder: gpui2::rgba(0xd07277ff).into(), |
| 254 | | − text_disabled: gpui2::rgba(0x555a63ff).into(), |
| 255 | | − text_accent: gpui2::rgba(0x74ade8ff).into(), |
| 256 | | − icon: gpui2::black(), |
| 257 | | − icon_muted: gpui2::rgba(0x838994ff).into(), |
| 258 | | − icon_disabled: gpui2::black(), |
| 259 | | − icon_placeholder: gpui2::black(), |
| 260 | | − icon_accent: gpui2::black(), |
| 261 | | − status_bar: gpui2::rgba(0x3b414dff).into(), |
| 262 | | − title_bar: gpui2::rgba(0x3b414dff).into(), |
| 263 | | − toolbar: gpui2::rgba(0x282c33ff).into(), |
| 264 | | − tab_bar: gpui2::rgba(0x2f343eff).into(), |
| 265 | | − editor: gpui2::rgba(0x282c33ff).into(), |
| 266 | | − editor_subheader: gpui2::rgba(0x2f343eff).into(), |
| 267 | | − editor_active_line: gpui2::rgba(0x2f343eff).into(), |
| 241 | + border: neutral().dark(6).into(), |
| 242 | + border_variant: neutral().dark(5).into(), |
| 243 | + border_focused: blue().dark(5).into(), |
| 244 | + border_transparent: system.transparent, |
| 245 | + elevated_surface: neutral().dark(2).into(), |
| 246 | + surface: neutral().dark(2).into(), |
| 247 | + background: neutral().dark(1).into(), |
| 248 | + element: neutral().dark(3).into(), |
| 249 | + element_hover: neutral().dark(4).into(), |
| 250 | + element_active: neutral().dark(5).into(), |
| 251 | + element_selected: neutral().dark(5).into(), |
| 252 | + element_disabled: neutral().dark_alpha(3).into(), |
| 253 | + element_placeholder: neutral().dark(11).into(), |
| 254 | + ghost_element: system.transparent, |
| 255 | + ghost_element_hover: neutral().dark(4).into(), |
| 256 | + ghost_element_active: neutral().dark(5).into(), |
| 257 | + ghost_element_selected: neutral().dark(5).into(), |
| 258 | + ghost_element_disabled: neutral().dark_alpha(3).into(), |
| 259 | + text: neutral().dark(12).into(), |
| 260 | + text_muted: neutral().dark(11).into(), |
| 261 | + text_placeholder: neutral().dark(11).into(), |
| 262 | + text_disabled: neutral().dark(10).into(), |
| 263 | + text_accent: blue().dark(12).into(), |
| 264 | + icon: neutral().dark(12).into(), |
| 265 | + icon_muted: neutral().dark(11).into(), |
| 266 | + icon_disabled: neutral().dark(10).into(), |
| 267 | + icon_placeholder: neutral().dark(11).into(), |
| 268 | + icon_accent: blue().dark(12).into(), |
| 269 | + status_bar: neutral().dark(2).into(), |
| 270 | + title_bar: neutral().dark(2).into(), |
| 271 | + toolbar: neutral().dark(2).into(), |
| 272 | + tab_bar: neutral().dark(2).into(), |
| 273 | + editor: neutral().dark(1).into(), |
| 274 | + editor_subheader: neutral().dark(2).into(), |
| 275 | + editor_active_line: neutral().dark_alpha(3).into(), |
| 268 | 276 | } |
| 269 | 277 | } |
| 270 | 278 | } |
| @@ -277,6 +285,25 @@ struct DefaultColorScaleSet { · 6 unmodified lines |
| 277 | 285 | dark_alpha: [&'static str; 12], |
| 278 | 286 | } |
| 279 | 287 | |
| 288 | +// See [ColorScaleSet] for why we use index-1. |
| 289 | +impl DefaultColorScaleSet { |
| 290 | + pub fn light(&self, index: usize) -> Hsla { |
| 291 | + self.light[index - 1].into() |
| 292 | + } |
| 293 | + |
| 294 | + pub fn light_alpha(&self, index: usize) -> Hsla { |
| 295 | + self.light_alpha[index - 1].into() |
| 296 | + } |
| 297 | + |
| 298 | + pub fn dark(&self, index: usize) -> Hsla { |
| 299 | + self.dark[index - 1].into() |
| 300 | + } |
| 301 | + |
| 302 | + pub fn dark_alpha(&self, index: usize) -> Hsla { |
| 303 | + self.dark_alpha[index - 1].into() |
| 304 | + } |
| 305 | +} |
| 306 | + |
| 280 | 307 | impl From<DefaultColorScaleSet> for ColorScaleSet { |
| 281 | 308 | fn from(default: DefaultColorScaleSet) -> Self { |
| 282 | 309 | Self::new( |