-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: implement dark/light mode theme selection and admin configuration section #131
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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace OpenForgeProject\MageForge\Model\Config\Source; | ||
|
|
||
| use Magento\Framework\Data\OptionSourceInterface; | ||
|
|
||
| class InspectorTheme implements OptionSourceInterface | ||
| { | ||
| /** | ||
| * @return array<int, array<string, string>> | ||
| */ | ||
| public function toOptionArray(): array | ||
| { | ||
| return [ | ||
| ['value' => 'dark', 'label' => (string) __('Dark')], | ||
| ['value' => 'light', 'label' => (string) __('Light')], | ||
| ['value' => 'auto', 'label' => (string) __('Auto (System Preference)')], | ||
| ]; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?xml version="1.0"?> | ||
| <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> | ||
| <acl> | ||
| <resources> | ||
| <resource id="Magento_Backend::admin"> | ||
| <resource id="Magento_Backend::stores"> | ||
| <resource id="Magento_Backend::stores_settings"> | ||
| <resource id="Magento_Config::config"> | ||
| <resource id="OpenForgeProject_MageForge::config_inspector" title="MageForge Inspector" sortOrder="50" /> | ||
| </resource> | ||
| </resource> | ||
| </resource> | ||
| </resource> | ||
| </resources> | ||
| </acl> | ||
| </config> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <?xml version="1.0"?> | ||
| <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> | ||
| <system> | ||
| <tab id="mageforge" translate="label" sortOrder="200"> | ||
| <label>MageForge</label> | ||
| </tab> | ||
| <section id="mageforge_inspector" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
| <label>Inspector</label> | ||
| <tab>mageforge</tab> | ||
| <resource>OpenForgeProject_MageForge::config_inspector</resource> | ||
| <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
| <label>General Settings</label> | ||
| <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
| <label>Enabled</label> | ||
| <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> | ||
| <config_path>dev/mageforge_inspector/enabled</config_path> | ||
| </field> | ||
| <field id="theme" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
| <label>Theme</label> | ||
| <source_model>OpenForgeProject\MageForge\Model\Config\Source\InspectorTheme</source_model> | ||
| <config_path>mageforge/inspector/theme</config_path> | ||
| <comment>Choose between Dark, Light, or Auto (System Preference) theme.</comment> | ||
| </field> | ||
|
Comment on lines
+18
to
+23
|
||
| </group> | ||
| </section> | ||
| </system> | ||
| </config> | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,6 +33,12 @@ | |||||||||||
| --mageforge-bg-dark: rgba(15, 23, 42, 0.98); | ||||||||||||
| --mageforge-bg-dark-alt: rgba(30, 41, 59, 0.98); | ||||||||||||
| --mageforge-border-color: rgba(148, 163, 184, 0.15); | ||||||||||||
|
|
||||||||||||
| /* Glass/Overlay Variables */ | ||||||||||||
| --mageforge-surface-glass: rgba(255, 255, 255, 0.05); | ||||||||||||
| --mageforge-surface-glass-hover: rgba(255, 255, 255, 0.08); /* slightly lighter for hover */ | ||||||||||||
| --mageforge-border-glass: rgba(255, 255, 255, 0.1); | ||||||||||||
| --mageforge-shadow-glow: rgba(255, 255, 255, 0.05); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
||||||||||||
| .mageforge-inspector--glow { | |
| box-shadow: 0 0 0 1px var(--mageforge-shadow-glow); | |
| } |
Copilot
AI
Feb 10, 2026
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.
In the light theme override, --mageforge-color-slate-400 is assigned a darker value than --mageforge-color-slate-500 (effectively swapping the 400/500 shades vs the :root definitions). This makes the variable naming inconsistent and can lead to unexpected colors where these variables are used; consider keeping shade ordering consistent and adjusting specific usages instead.
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.
getTheme()readsmageforge/inspector/themefrom the default scope only; this means website/store-view overrides configured insystem.xmlwon’t be reflected on the storefront. Read this value using store scope (e.g., passScopeInterface::SCOPE_STOREtogetValue()) so the frontend honors per-store configuration.