-
Notifications
You must be signed in to change notification settings - Fork 3.6k
chore: theme and code refactor #5983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,6 +120,19 @@ | |
| --color-sidebar-shadow-2xl: var(--color-shadow-2xl); | ||
| --color-sidebar-shadow-3xl: var(--color-shadow-3xl); | ||
| --color-sidebar-shadow-4xl: var(--color-shadow-4xl); | ||
|
|
||
| /* pi */ | ||
| --color-pi-50: var(--color-background-90); | ||
| --color-pi-100: var(--color-background-90); | ||
| --color-pi-200: var(--color-primary-200); | ||
| --color-pi-300: var(--color-primary-200); | ||
| --color-pi-400: var(--color-primary-200); | ||
| --color-pi-500: var(--color-primary-200); | ||
| --color-pi-600: 151, 150, 246; | ||
| --color-pi-700: var(--color-primary-100); | ||
| --color-pi-800: 57, 56, 149; | ||
| --color-pi-900: 30, 29, 78; | ||
| --color-pi-950: 14, 14, 37; | ||
| } | ||
|
|
||
| [data-theme="light"], | ||
|
|
@@ -129,6 +142,19 @@ | |
| --color-background-100: 255, 255, 255; /* primary bg */ | ||
| --color-background-90: 247, 247, 247; /* secondary bg */ | ||
| --color-background-80: 232, 232, 232; /* tertiary bg */ | ||
|
|
||
| /* pi */ | ||
| --color-pi-50: var(--color-background-90); | ||
| --color-pi-100: var(--color-background-90); | ||
| --color-pi-200: var(--color-primary-200); | ||
| --color-pi-300: var(--color-primary-200); | ||
| --color-pi-400: var(--color-primary-200); | ||
| --color-pi-500: var(--color-primary-200); | ||
| --color-pi-600: 151, 150, 246; | ||
| --color-pi-700: var(--color-primary-100); | ||
| --color-pi-800: 57, 56, 149; | ||
| --color-pi-900: 30, 29, 78; | ||
| --color-pi-950: 14, 14, 37; | ||
|
Comment on lines
+145
to
+157
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Ensure theme color consistency across contexts. The pi theme colors are duplicated across different theme contexts (light/dark). This could lead to maintenance issues if colors need to be updated. Consider:
Refactor the theme-specific sections to only include overrides: [data-theme="light"],
[data-theme="light-contrast"] {
/* Only include pi colors that differ from root */
- --color-pi-50: var(--color-background-90);
- --color-pi-100: var(--color-background-90);
- /* ... remove duplicated colors ... */
}
[data-theme="dark"],
[data-theme="dark-contrast"] {
/* Only include pi colors that differ from root */
- --color-pi-50: var(--color-background-90);
- --color-pi-100: var(--color-background-90);
- /* ... remove duplicated colors ... */
}Also applies to: 259-271 |
||
| } | ||
|
|
||
| [data-theme="light"] { | ||
|
|
@@ -230,6 +256,19 @@ | |
| --color-shadow-xl: 0px 0px 14px 0px rgba(0, 0, 0, 0.25), 0px 6px 10px 0px rgba(0, 0, 0, 0.55); | ||
| --color-shadow-2xl: 0px 0px 18px 0px rgba(0, 0, 0, 0.25), 0px 8px 12px 0px rgba(0, 0, 0, 0.6); | ||
| --color-shadow-3xl: 0px 4px 24px 0px rgba(0, 0, 0, 0.3), 0px 12px 40px 0px rgba(0, 0, 0, 0.65); | ||
|
|
||
| /* pi */ | ||
| --color-pi-50: var(--color-background-90); | ||
| --color-pi-100: var(--color-background-90); | ||
| --color-pi-200: var(--color-primary-200); | ||
| --color-pi-300: var(--color-primary-200); | ||
| --color-pi-400: var(--color-primary-200); | ||
| --color-pi-500: var(--color-primary-200); | ||
| --color-pi-600: 151, 150, 246; | ||
| --color-pi-700: var(--color-primary-100); | ||
| --color-pi-800: 57, 56, 149; | ||
| --color-pi-900: 30, 29, 78; | ||
| --color-pi-950: 14, 14, 37; | ||
| } | ||
|
|
||
| [data-theme="dark"] { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Reduce code duplication in pi theme color definitions.
The pi theme color definitions are identical across three different contexts (root, light theme, and dark theme). This violates the DRY principle and makes maintenance more challenging.
Consider moving the common pi theme colors to the shared theme section where other common properties are defined (around line 320 where
[data-theme="light"], [data-theme="dark"], [data-theme="light-contrast"], [data-theme="dark-contrast"]are grouped). This would make the code more maintainable and reduce the risk of inconsistencies when updating colors.[data-theme="light"], [data-theme="dark"], [data-theme="light-contrast"], [data-theme="dark-contrast"] { /* existing common properties */ + + /* pi theme colors */ + --color-pi-50: var(--color-background-90); + --color-pi-100: var(--color-background-90); + --color-pi-200: var(--color-primary-200); + --color-pi-300: var(--color-primary-200); + --color-pi-400: var(--color-primary-200); + --color-pi-500: var(--color-primary-200); + --color-pi-600: 151, 150, 246; + --color-pi-700: var(--color-primary-100); + --color-pi-800: 57, 56, 149; + --color-pi-900: 30, 29, 78; + --color-pi-950: 14, 14, 37; }Also applies to: 126-138, 229-240