-
Notifications
You must be signed in to change notification settings - Fork 710
Fixes #4057 - MASSIVE! Fully implements ColorScheme
->Scheme
+ VisualRole
+ Colors.
->SchemeManager.
#4062
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
base: v2_develop
Are you sure you want to change the base?
Conversation
… v2_4057-Scheme-VisualRole
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.
Pull Request Overview
This PR refactors Terminal.Gui’s configuration and color management by renaming and restructuring APIs to improve clarity, thread-safety, and test reliability. Key changes include the renaming of ColorScheme to Scheme (with corresponding API changes), the introduction of the VisualRole enum, and various adjustments to unit tests and configuration to support the new design.
Reviewed Changes
Copilot reviewed 333 out of 333 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
Examples/UICatalog/Scenarios/CollectionNavigatorTester.cs | Replaced ColorScheme usage with SchemeName. |
Examples/UICatalog/Scenarios/Clipping.cs | Updated color API from ColorScheme to SchemeName. |
Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs | Converted ColorScheme assignments and left commented legacy code. |
Examples/UICatalog/Scenarios/Buttons.cs | Updated scheme selection via SchemeName and iteration over schemes. |
Examples/UICatalog/Scenarios/Arrangement.cs | Replaced direct ColorScheme access with GetAttributeForRole and SetScheme. |
Examples/UICatalog/Scenarios/AllViewsTester.cs | Renamed settings pane to propertiesEditor and revised scheme handling. |
Examples/UICatalog/Scenarios/Adornments.cs | Adjusted scheme updates using SetScheme. |
Examples/UICatalog/Resources/config.json | Removed ColorSchemes block in favor of Schemes. |
Examples/SelfContained/Program.cs, ReactiveExample/Program.cs, etc. | Added ConfigurationManager.Enable call. |
Examples/CommunityToolkitExample/* | Updated color-related API usages to work with new Scheme naming. |
Comments suppressed due to low confidence (1)
Examples/CommunityToolkitExample/LoginViewModel.cs:107
- Ensure that the renaming from 'ValidationColorScheme' to 'ValidationScheme' is applied consistently throughout the codebase and documentation.
- ValidationColorScheme = Colors.ColorSchemes ["Error"];
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.
Good work. I like it very much. The only repair I would like to express is when I press the keyboard keys down and up, on radio button or checked opened menus I can't see an indicator on what is currently selected. I know we can select by hot key, but that's the only thing I don't like in the v2 menus navigation.
Pressing F9 to open the menu, then press Cursor.Right and then press Esc will exit the UICatalog instead only closing the menu.
Thanks. I'll be fixing those menu issues in #4013. I couldn't address the selection thing without fixing Schemes first. |
… v2_4057-Scheme-VisualRole
This is fun. Based on all this, I've been able to significantly improve how transparent shadows are drawn. Previously the shadow was a lame "highlight" of the Normal attribute of the underlying view. And the logic for what the underlying view as lame. Now, each cell of the shadow actually is a smarter highlight of the underlying cell. |
… v2_4057-Scheme-VisualRole
…h means restart the timer! This was causing mac/linux unit test failures. I think
Broke TextView/TextField selection
HUGE PR
This PR introduces a significant refactoring of Terminal.Gui's Configuration Management system, addressing issue #4057 and a bunch of other related issues. The changes include:
ConfigurationManager
SerializableConfigruationProperty
->ConfigProperty
).[ModuleInitalizer
] to ensure that CM caches the original values of all[ConfigProperty]
s and provides APIs for resetting those values back (ConfigurationManager.ResetToHardCodedValues
).Application.Init
. Instead CM is simply process-wide.ConfigurationManager.Enable
to enable it.ColorScheme
toScheme
. EnablesSchemeManager.GetCurrentSchemes()
as the API that replaces the oldColorSchemes
static class.VisualRole
to replace string-basedColorSchemes[???]
identifiers.View.Scheme
API signficantlyView.ColorScheme
->View.Scheme
View.HasScheme
to indicate whether a Scheme was explicitly set or not.Get/SetScheme
(used byScheme
get/set). Enable...GettingScheme
/OnGettingScheme
cancellable eventSettingScheme
/OnSettingScheme
cancellable eventScheme
is no longervirtual
(the above addressses).HighlightStyle.Hover
is DISABLED in this PR. to be fixed inHighlightStyle.Hover
etc... needs a different implementation #3753.Much of the vast churn in this PR was done to finally address a slew of non-deterministic unit test problems having to do with static state. There are still some non-CM related issues buried in there, but I've killed most of them here. Note: Any unit test that uses
Configuration.Enable
MUST NOT be inParallelizable
. However, if you don't callEnable
or useApplication
it's highly likely Parallelizable will work.IMPORTANT: If you rely on
View.Scheme
beingnull
... STOP. Instead useHasScheme
.Fixes
ColorScheme
toScheme
and MigrateColors
toConfigurationManager.Themes
#4057ConfigurationManager
-DeepMemberwiseClone
does not do what it says #4072ConfigurationManager
- It's stupid that it tries to be scoped byApplication.Init
#4073GetNormalColor
etc.... #4016TextStyle
Style
#4084Applied
andUpdated
events are clumsy #2871ConfigurationManager
- It's a bug for anySomeProperty = DefaultSomeProperty
ifSomeProperty
isn't nullable #4021View.GetSizeRequiredForSubViews()
#4089Proposed Changes/Todos
ColorScheme
toScheme
VisualRole
enumView.GetXXXColor ()
withView.GetAttributeForRole ()
Scheme
andAttribute
related APIs inView
are fully baked and thought through.CM.Enable
more rational - Have it takeConfigLocation
View.Enable
inView.Drawing
, built-in Views and Scenarios.Text Styles
scenario to show moreStyle
is misapplied/artifactsLoad()
"Schemes": []
doesn't accept partial dict. Just overwrites dest.ConfigurationManager
- It's a bug for anySomeProperty = DefaultSomeProperty
ifSomeProperty
isn't nullable #4021Now:
config.md
Deep DiveSchemes
Scenario that shows all views and lets you play with applying different schemesVisualRole
(Active
,HotActive
,Highlight
)drawing.md
Deep DiveHover
withHighlight
For Future PRs
Toplevel
anyway?). #4086HighlightStyle.Hover
etc... needs a different implementation #3753INotifyPropertyChanged
support toConfigProperty
Pull Request checklist:
CTRL-K-D
to automatically reformat your files before committing.dotnet test
before commit///
style comments)