mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-29 01:42:03 +00:00
Aristo3: Remove redundant system color overrides matching CPColor defaults
Aristo3 previously defined state-independent values for alternateSelectedControlColor, secondarySelectedControlColor, and selectedTextBackgroundColor, as well as explicit DarkAqua values for five system colors—all identical to CPColor's defaults. Because state-independent theme entries apply across all appearances, the first three masked CPColor's default DarkAqua definitions and remained light in dark windows. These eight redundant entries are removed so the colors resolve directly to CPColor's default definitions, while Aristo3 retains its custom dark controlBackgroundColor. Two tests verify this behavior: controlBackgroundColor resolves to Aristo3's dark override, and no system color defines a state-independent value without a corresponding dark variant.
This commit is contained in:
1 parent
cd3372e2b1
commit
8a88f98f67
4 files changed
+70
-14
No files matched your search
@@ -27,7 +27,8 @@
|
||||
|
||||
This file is the table of the values for every appearance (A3ThemeColorValues).
|
||||
Aristo3DarkColors.j gives the values for the dark appearance (A3DarkThemeColorValues), and
|
||||
the dark values of System colours that Aristo3 uses (A3DarkSystemColorValues).
|
||||
the dark values that Aristo3 gives System colours where it wants a value other than
|
||||
CPColor's built-in one (A3DarkSystemColorValues).
|
||||
+[Aristo3ThemeDescriptor themedColor] registers the tables.
|
||||
|
||||
A constant's colour name is its identifier without A3Color or A3CPColor, with a lower-case
|
||||
|
||||
@@ -168,17 +168,13 @@ A3DefineDarkThemeColor(@"windowViewWindowShadowColor", [CPColor colorWithCSSStri
|
||||
// System colours
|
||||
|
||||
/*
|
||||
System colours with AppKit's DarkAqua value on macOS 27, in sRGB, as CPColor holds
|
||||
AppKit's Aqua values: the window background, the source-list background, secondary text,
|
||||
and the gray and purple tints. A System colour without a value here keeps its Aqua value
|
||||
in the dark appearance, so a window background stayed white, the source list stayed light
|
||||
and secondary text stayed black.
|
||||
CPColor holds a built-in DarkAqua value for every System colour, with AppKit's values
|
||||
(see _CPSystemColorBuiltInSets in CPColor.j). Aristo3 gives a System colour a dark value
|
||||
only where it wants a value of its own: controlBackgroundColor, above.
|
||||
|
||||
Aristo3 gave five System colours their DarkAqua values here, because CPColor held only
|
||||
Aqua values. The values equalled CPColor's built-in DarkAqua values, so they are gone.
|
||||
*/
|
||||
A3DefineDarkSystemColor(@"windowBackgroundColor", [CPColor colorWithRed:0.1176 green:0.1176 blue:0.1176 alpha:1.0]);
|
||||
A3DefineDarkSystemColor(@"_sourceListBackgroundColor", [CPColor colorWithRed:0.1765 green:0.1765 blue:0.1765 alpha:0.9]);
|
||||
A3DefineDarkSystemColor(@"secondaryLabelColor", [CPColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.549]);
|
||||
A3DefineDarkSystemColor(@"systemGrayColor", [CPColor colorWithRed:0.5961 green:0.5961 blue:0.6157 alpha:1.0]);
|
||||
A3DefineDarkSystemColor(@"systemPurpleColor", [CPColor colorWithRed:0.8588 green:0.2039 blue:0.949 alpha:1.0]);
|
||||
|
||||
// Rule editor: the alternate row matches the table's; the borders match the table divider.
|
||||
|
||||
|
||||
@@ -244,11 +244,14 @@ function A3MaskIcon(aMaskImage, aColor)
|
||||
+ (CPColor)themedColor
|
||||
{
|
||||
var color = [CPColor redColor],
|
||||
/*
|
||||
Aristo3 gave alternateSelectedControlColor, secondarySelectedControlColor and
|
||||
selectedTextBackgroundColor a value without a state. Each value equalled CPColor's
|
||||
built-in Aqua value, and a value without a state applies in every appearance, so it
|
||||
hid the built-in DarkAqua value. The colours now take CPColor's built-in values.
|
||||
*/
|
||||
themedColorValues =
|
||||
[
|
||||
[@"alternate-selected-control-color", [[CPColor alloc] _initWithRGBA:[0.22, 0.46, 0.84, 1.0]]],
|
||||
[@"secondary-selected-control-color", [[CPColor alloc] _initWithRGBA:[0.83, 0.83, 0.83, 1.0]]],
|
||||
[@"selected-text-background-color", [CPColor colorWithHexString:"99CCFF"]],
|
||||
[@"selected-text-inactive-background-color", [CPColor colorWithHexString:"CCCCCC"]],
|
||||
[@"supported-appearances", [CPAppearanceNameAqua, CPAppearanceNameDarkAqua]],
|
||||
[@"theme-colors", A3ThemeColorValues],
|
||||
|
||||
@@ -261,6 +261,62 @@ var Aristo3ThemeColorsTestObjectDescriptions = ["Catalog color", "Asset color",
|
||||
[self assertTrue:mismatches.length === 0 message:mismatches.join("\n")];
|
||||
}
|
||||
|
||||
/*
|
||||
Aristo3 keeps a dark value of its own for controlBackgroundColor, the background of a
|
||||
table view. In Aqua the colour keeps CPColor's built-in value.
|
||||
*/
|
||||
- (void)testControlBackgroundColorTakesAristo3sOwnDarkValue
|
||||
{
|
||||
var color = [CPColor colorWithCatalogName:@"System" colorName:@"controlBackgroundColor"],
|
||||
expectedComponents = [[1.0, 1.0, 1.0, 1.0], [45.0 / 255.0, 45.0 / 255.0, 45.0 / 255.0, 1.0]],
|
||||
appearanceNames = [CPAppearanceNameAqua, CPAppearanceNameDarkAqua];
|
||||
|
||||
[CPTheme setDefaultTheme:[self aristo3]];
|
||||
|
||||
for (var i = 0; i < appearanceNames.length; i++)
|
||||
{
|
||||
var components = nil;
|
||||
|
||||
[[CPAppearance appearanceNamed:appearanceNames[i]] performAsCurrentDrawingAppearance:function()
|
||||
{
|
||||
components = [[color colorUsingColorSpaceName:nil] components];
|
||||
}];
|
||||
|
||||
for (var j = 0; j < 4; j++)
|
||||
[self assert:ROUND(expectedComponents[i][j] * 10000) equals:ROUND(components[j] * 10000) message:@"controlBackgroundColor in " + appearanceNames[i] + ", component " + j];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
A theme value without a state applies in every appearance. A System colour with such a
|
||||
value and no dark value would hide CPColor's built-in dark value under a theme that
|
||||
supports DarkAqua, so Aristo3 gives none.
|
||||
*/
|
||||
- (void)testNoSystemColorHasAValueWithoutAStateAndNoDarkValue
|
||||
{
|
||||
var attributes = [[self aristo3] attributesForClass:@"color"],
|
||||
names = [attributes allKeys],
|
||||
normalKey = String(CPThemeStateNormal),
|
||||
darkKey = String(CPThemeStateAppearanceDarkAqua),
|
||||
violations = [];
|
||||
|
||||
for (var i = 0; i < names.length; i++)
|
||||
{
|
||||
var name = names[i],
|
||||
colorName = name.replace(/-([a-z])/g, function(aMatch, aLetter) { return aLetter.toUpperCase(); });
|
||||
|
||||
if (![CPColor colorWithCatalogName:@"System" colorName:colorName])
|
||||
continue;
|
||||
|
||||
var values = [[attributes objectForKey:name] values];
|
||||
|
||||
if ([values containsKey:normalKey] && ![values containsKey:darkKey])
|
||||
violations.push(name);
|
||||
}
|
||||
|
||||
[self assertTrue:violations.length === 0 message:violations.join(", ")];
|
||||
}
|
||||
|
||||
/*
|
||||
A site that joins a named colour into a string with + writes the colour's description.
|
||||
Every CSS value converts in Aqua and in DarkAqua, and no text holds the description of
|
||||
|
||||
Reference in new issue
Block a user