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