Skip to content

Feat/color schemes rework#3878

Draft
ErikPre wants to merge 8 commits into
CactuseSecurity:importer-reworkfrom
Laennart:feat/color-schemes-rework
Draft

Feat/color schemes rework#3878
ErikPre wants to merge 8 commits into
CactuseSecurity:importer-reworkfrom
Laennart:feat/color-schemes-rework

Conversation

@ErikPre

@ErikPre ErikPre commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator

Merging into Importer Rework branch

@ErikPre ErikPre requested review from Copilot and tpurschke November 4, 2025 15:02
@ErikPre

ErikPre commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator Author

@tpurschke Ich habe die update sql erstmal 9.1.1.sql genannt, ich bin mir da nicht sicher in welche version und datei die kommt

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds a customizable color scheme feature to the UI, allowing users to select from predefined color schemes (blue, green, red, purple). The changes enable dynamic theming of the navigation bar and headings through CSS variables.

  • Introduced ColorScheme class with predefined color schemes and properties for gradient colors
  • Added color scheme selection UI in settings with persistence to configuration
  • Updated CSS to use CSS variables for dynamic color theming

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
roles/lib/files/FWO.Config.Api/Data/ColorScheme.cs New class defining available color schemes with hex values and a lookup method
roles/lib/files/FWO.Config.Api/Data/ConfigData.cs Added ColorScheme property to persist user's color scheme selection
roles/ui/files/FWO.UI/Services/ColorThemeService.cs New service for managing user color mode state (appears unused in this PR)
roles/ui/files/FWO.UI/Shared/NavigationMenu.razor Applied color scheme CSS variables to navigation bar for dynamic theming
roles/ui/files/FWO.UI/Pages/Settings/SettingsDefaults.razor Added UI dropdown for color scheme selection with save functionality
roles/ui/files/FWO.UI/wwwroot/css/site.css Updated gradient and heading styles to support CSS variables with fallbacks
roles/database/files/upgrade/8.8.11.sql Database migration adding localized text entries for color schemes
roles/database/files/sql/idempotent/fworch-texts.sql Added localized text entries for color scheme UI labels

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread roles/lib/files/FWO.Config.Api/Data/ColorScheme.cs Outdated
Comment thread roles/database/files/upgrade/9.1.1.sql Outdated
Comment on lines +3 to +4
INSERT INTO txt VALUES ('color_scheme_standard', 'German', 'Standard Farbschema');
INSERT INTO txt VALUES ('color_scheme_standard', 'English', 'Standard Color Scheme');

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The database migration includes text entries for 'color_scheme_standard', but this color scheme name doesn't exist in the ColorScheme.AvailableSchemes list. The actual default scheme is named 'color_scheme_blue'. Either add 'color_scheme_standard' as an available scheme or remove these unused text entries.

Suggested change
INSERT INTO txt VALUES ('color_scheme_standard', 'German', 'Standard Farbschema');
INSERT INTO txt VALUES ('color_scheme_standard', 'English', 'Standard Color Scheme');

Copilot uses AI. Check for mistakes.
Comment thread roles/database/files/sql/idempotent/fworch-texts.sql Outdated
{
configData.DefaultLanguage = selectedLanguage.Name;
configData.ColorScheme = selectedColorScheme.Name;
StateHasChanged();

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling StateHasChanged() in the middle of the Save() method is unnecessary and could cause premature re-rendering before the save operation completes. If a state refresh is needed, it should be called after all data modifications are complete, or removed entirely if the framework handles it automatically after the async operation completes.

Suggested change
StateHasChanged();

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +42
bool allGood = false;
if (_UserColorModes.TryAdd(key, mode))
{
allGood = true;

}
else
{
allGood = _UserColorModes.TryUpdate(key, mode, _UserColorModes[key]);
}

Copilot AI Nov 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.

Suggested change
bool allGood = false;
if (_UserColorModes.TryAdd(key, mode))
{
allGood = true;
}
else
{
allGood = _UserColorModes.TryUpdate(key, mode, _UserColorModes[key]);
}
bool allGood = _UserColorModes.TryAdd(key, mode)
? true
: _UserColorModes.TryUpdate(key, mode, _UserColorModes[key]);

Copilot uses AI. Check for mistakes.

@tpurschke tpurschke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see inline comments - @Y4nnikH maybe you can also have a look at Erik's 2 PRs

Comment thread roles/database/files/upgrade/9.1.1.sql Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all changes to txt table are made only in roles/database/files/sql/idempotent/fworch-texts.sql

Comment thread roles/database/files/sql/idempotent/fworch-texts.sql Outdated
Comment thread roles/lib/files/FWO.Config.Api/Data/ColorScheme.cs Outdated
@tpurschke

Copy link
Copy Markdown
Contributor

@tpurschke Ich habe die update sql erstmal 9.1.1.sql genannt, ich bin mir da nicht sicher in welche version und datei die kommt

I do not really see any file with that name but we do not need it anyway. Also the file 8.8.11 should be removed

@tpurschke tpurschke marked this pull request as draft November 5, 2025 17:35
@sonarqubecloud

sonarqubecloud Bot commented Nov 7, 2025

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@ErikPre ErikPre self-assigned this Nov 7, 2025
<div class="position-sticky" style="z-index:15; top:0px;">
<nav id="navbar" class="navbar navbar-expand-xl navbar-dark bg-blue shadow w-100">
<nav id="navbar" class="navbar navbar-expand-xl navbar-dark bg-blue shadow w-100"
style="--bg-color:@(ColorScheme.GetSchemeByName(userConfig.ColorScheme).Hex);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks evil to me. Using styles parameter for this is ok if not possible otherwise but using the parameter to set variable values is odd to me. Can you explain why this is needed instead of just using the values of ColorScheme.GetSchemeByName(userConfig.ColorScheme).Hex directly in the styles?

@Y4nnikH Y4nnikH linked an issue Apr 16, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI - allow for alternative color schemes

4 participants