Palette: Make all properties virtual & Improve docs#8987
Palette: Make all properties virtual & Improve docs#8987ScarletKuro merged 7 commits intoMudBlazor:devfrom
virtual & Improve docs#8987Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #8987 +/- ##
==========================================
+ Coverage 89.82% 90.50% +0.67%
==========================================
Files 412 395 -17
Lines 11878 12138 +260
Branches 2364 2369 +5
==========================================
+ Hits 10670 10986 +316
+ Misses 681 620 -61
- Partials 527 532 +5 ☔ View full report in Codecov by Sentry. |
I think you need to give more explanation about why this change is useful. Otherwise, it sounds like we should switch all classes to records just because "we get good stuff". I just don't see how this change is being utilized in our code. Also, isn't a record mainly for making immutable data, because by default the properties in records are get and init when you declare them in the primary constructor? Here, we have get and set properties. |
|
@ScarletKuro I don't want to duplicate my palette styles MudTheme _theme = new()
{
PaletteLight = new PaletteLight()
{
Primary = "#776be7",
PrimaryLighten = "#978dec",
Info = "#776be7",
AppbarText = "#ffffffe6",
Background = "#f7f6fb",
TextDisabled = "#424242",
HoverOpacity = 0.1,
},
PaletteDark = new PaletteDark()
{
Primary = "#776be7",
Info = "#776be7",
AppbarText = "#ffffffe6",
TextPrimary = "#ffffffcc",
TextSecondary = "#ffffff99",
TextDisabled = "#ffffffb2",
HoverOpacity = 0.1,
},
} Palette _basePalette = new()
{
Primary = "#776be7",
Info = "#776be7",
AppbarText = "#ffffffe6",
HoverOpacity = 0.1,
};
MudTheme _theme = new()
{
PaletteLight = _basePalette with
{
PrimaryLighten = "#978dec",
Background = "#f7f6fb",
TextDisabled = "#424242",
},
PaletteDark = _basePalette with
{
TextPrimary = "#ffffffcc",
TextSecondary = "#ffffff99",
TextDisabled = "#ffffffb2",
},
}Though I should have made Palette non-abstract
What's wrong with data classes being turned into records?
Should palette be immutable since it's only used once right? 🤷 |
Nothing at all. I just want to know your use case for this change. Are we making this change for fun, or is there a good reason? This is a breaking change at the API level, since records can only inherit from other records. Therefore, if people have their own classes inheriting from it, they will need to change those to records as well. That's why I'm asking if this change is worth making, considering it is a breaking change.
|
jperson2000
left a comment
There was a problem hiding this comment.
Your edits for simpler docs are spot on! Is there a need for a palette for colorblind folks? If so, I think I could put one together with someone to help test. (A different PR of course)
@jperson2000 I definitely have accessibility concerns about certain contrasts in the default palette (ex: the text is way too gray) which I have to address in my own apps. I don't know if changing that is acceptable but I bet a separate one for color blindness would be. Maybe we can work something out - cc @henon |
|
+1 on immutability. Shall we make this change in the next major version together with other theming changes? |
This reverts commit fe77c62.
record, Make more virtual, Improve docsvirtual & Improve docs
Wise idea @henon @ScarletKuro I've updated the PR to exclude |
Feel free to add to v8 project. |
Description
virtualthat weren't alreadyHow Has This Been Tested?
Type of Changes
Checklist
dev).