Skip to content
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

UI colors #62

Merged
merged 4 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Command/jskit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: node
JSBundleIdentifier: io.breakside.jskit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSExecutableName: jskit
NPMOrganization: breakside
JSResources:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/APIKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.APIKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSIncludeDirectories:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/APIKitTesting/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.APIKitTesting
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSLicenseNotice: |
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/AuthKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.AuthKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSLicenseNotice: |
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/CSSOM/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.CSSOM
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/ChartKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.ChartKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2021 Breakside Inc.
# JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/ConferenceKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.ConferenceKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/DBKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.DBKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/DOM/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.DOM
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/Dispatch/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.Dispatch
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
html: Dispatch+HTML.js
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/FontKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.FontKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/Foundation/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.Foundation
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/ImageKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.ImageKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/MediaKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.MediaKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/MediaKitUI/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.MediaKitUI
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/NotificationKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.NotificationKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2021 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/PDFKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.PDFKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSLicenseNotice: |
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/QRKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.QRKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSLicenseNotice: |
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/SearchKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.SearchKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSLicenseNotice: |
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/SecurityKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.SecurityKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/ServerKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.ServerKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/ServerKitTesting/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.ServerKitTesting
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSLicenseNotice: |
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/TestKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.TestKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSLicenseNotice: |
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/UIKit/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.UIKit
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSBundleEnvironments:
Expand Down
23 changes: 14 additions & 9 deletions Frameworks/UIKit/JSColor+UIKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ JSColor.definePropertiesFromExtensions({
JSColor.defineInitMethod("initWithUIStyles");

// Common Colors
JSColorSpace.ui.setStylesForName("background", JSColor.white, JSColor.initWithWhite(0.15));
JSColorSpace.ui.setStylesForName("text", JSColor.black.colorWithAlpha(0.9), JSColor.white.colorWithAlpha(0.9));
JSColorSpace.ui.setStylesForName("secondaryText", JSColor.black.colorWithAlpha(0.6), JSColor.white.colorWithAlpha(0.6));
JSColorSpace.ui.setStylesForName("highlight", JSColor.initWithRGBA(0, 0.5, 1), JSColor.initWithRGBA(0, 0.5, 1));
JSColorSpace.ui.setStylesForName("mutedHighlight", JSColor.black.colorWithAlpha(0.15), JSColor.white.colorWithAlpha(0.1));
JSColorSpace.ui.setStylesForName("highlightedText", JSColor.white, JSColor.white);
JSColorSpace.ui.setColorForName("placeholderText", JSColor.text.colorWithAlpha(0.3));
JSColorSpace.ui.setStylesForName("background", JSColor.white, JSColor.initWithWhite(0.15), JSColor.white, JSColor.initWithWhite(0.15));
JSColorSpace.ui.setStylesForName("shadedBackground", JSColor.initWithWhite(0.85), JSColor.initWithWhite(0.30), JSColor.white.colorDarkenedByPercentage(0.2), JSColor.black.colorLightenedByPercentage(0.3));
JSColorSpace.ui.setStylesForName("secondaryShadedBackground", JSColor.initWithWhite(0.965), JSColor.initWithWhite(0.25), JSColor.white, JSColor.black);
JSColorSpace.ui.setStylesForName("separator", JSColor.initWithWhite(0.85), JSColor.initWithWhite(0.30), JSColor.initWithWhite(0.5), JSColor.initWithWhite(0.5));
JSColorSpace.ui.setStylesForName("secondarySeparator", JSColor.initWithWhite(0.965), JSColor.initWithWhite(0.25), JSColor.initWithWhite(0.5), JSColor.initWithWhite(0.5));
JSColorSpace.ui.setStylesForName("text", JSColor.black.colorWithAlpha(0.9), JSColor.white.colorWithAlpha(0.9), JSColor.black, JSColor.white);
JSColorSpace.ui.setStylesForName("secondaryText", JSColor.black.colorWithAlpha(0.6), JSColor.white.colorWithAlpha(0.6), JSColor.black, JSColor.white);
JSColorSpace.ui.setStylesForName("highlight", JSColor.initWithRGBA(0, 0.5, 1), JSColor.initWithRGBA(0, 0.5, 1), JSColor.initWithRGBA(0, 0.5, 1), JSColor.initWithRGBA(0, 0.5, 1));
JSColorSpace.ui.setStylesForName("mutedHighlight", JSColor.black.colorWithAlpha(0.15), JSColor.white.colorWithAlpha(0.1), JSColor.black.colorWithAlpha(0.4), JSColor.white.colorWithAlpha(0.3));
JSColorSpace.ui.setStylesForName("highlightedText", JSColor.white, JSColor.white, JSColor.white, JSColor.white);
JSColorSpace.ui.setColorForName("placeholderText", JSColor.black.colorWithAlpha(0.3), JSColor.white.colorWithAlpha(0.3), JSColor.black.colorWithAlpha(0.7), JSColor.white.colorWithAlpha(0.7));
JSColorSpace.ui.setStylesForName("destructive", JSColor.initWithRGBA(0.8,0,0), JSColor.initWithRGBA(1,0.5,0.5));

// Control Colors
Expand All @@ -58,14 +62,15 @@ JSColorSpace.ui.setStylesForName("disabledControlTitle", JSColor.initWithWhite(0
JSColorSpace.ui.setColorForName("controlShadow", JSColor.black.colorWithAlpha(0.1));

// Window Colors
JSColorSpace.ui.setStylesForName("window", JSColor.initWithWhite(0.94), JSColor.initWithWhite(0.2));
JSColorSpace.ui.setStylesForName("window", JSColor.initWithWhite(0.94), JSColor.initWithWhite(0.2), JSColor.white, JSColor.initWithWhite(0.2));
JSColorSpace.ui.setStylesForName("windowBorder", JSColor.clear, JSColor.white.colorWithAlpha(0.1), JSColor.black, JSColor.white);
JSColorSpace.ui.setColorForName("windowShadow", JSColor.black.colorWithAlpha(0.4));
JSColorSpace.ui.setColorForName("toolbarTitle", JSColor.text.colorWithAlpha(0.6));

// Tooltip Colors
JSColorSpace.ui.setColorForName("tooltip", JSColor.window);
JSColorSpace.ui.setColorForName("tooltipText", JSColor.text);
JSColorSpace.ui.setStylesForName("tooltipBorder", JSColor.initWithWhite(0.7), JSColor.black);
JSColorSpace.ui.setStylesForName("tooltipBorder", JSColor.initWithWhite(0.7), JSColor.black, JSColor.black, JSColor.white);
JSColorSpace.ui.setColorForName("tooltipShadow", JSColor.black.colorWithAlpha(0.2));

// Menu Colors
Expand Down
7 changes: 7 additions & 0 deletions Frameworks/UIKit/UINavigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
disabledItemColor: null,
itemInsets: null,
itemTitleInsets: null,
itemSpacing: 0,
backButtonTitleInsets: null,
backButtonImage: null,
backButtonColor: null,
Expand Down Expand Up @@ -738,6 +739,9 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
xLeft = this.titleInsets.left;
}
for (i = 0, l = props.leftBarItemViews.length; i < l; ++i){
if (i > 0){
xLeft += this.itemSpacing;
}
barItemView = props.leftBarItemViews[i];
barItemView.sizeToFitSize(JSSize(xRight - xLeft, itemHeight));
barItemView.untransformedFrame = JSRect(JSPoint(xLeft, y + (itemHeight - barItemView.bounds.size.height) / 2), barItemView.bounds.size);
Expand All @@ -749,6 +753,9 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
xRight -= barItemView.bounds.size.width;
barItemView.untransformedFrame = JSRect(JSPoint(xRight, y + (itemHeight - barItemView.bounds.size.height) / 2), barItemView.bounds.size);
barItemView.hidden = xRight < xLeft;
if (i > 0){
xRight -= this.itemSpacing;
}
}

var availableTitleWidth = xRight - xLeft;
Expand Down
18 changes: 18 additions & 0 deletions Frameworks/UIKit/UIPopupButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,11 @@ JSClass("UIPopupButtonImageStyler", UIPopupButtonStyler, {
overBackgroundColor: null,
cornerRadius: 0,
titleInsets: null,
normalBorderColor: null,
disabledBorderColor: null,
overBorderColor: null,
activeBorderColor: null,
borderWidth: 0,

init: function(){
this.initWithColor(JSColor.text);
Expand Down Expand Up @@ -863,6 +868,14 @@ JSClass("UIPopupButtonImageStyler", UIPopupButtonStyler, {
this.disabledBackgroundColor = this.normalBackgroundColor.colorWithAlpha(0.5);
}
}
if (this.normalBorderColor !== null){
if (this.activeBorderColor === null){
this.activeBorderColor = this.normalBorderColor.colorDarkenedByPercentage(0.2);
}
if (this.disabledBorderColor === null){
this.disabledBorderColor = this.normalBorderColor.colorWithAlpha(0.5);
}
}
},

initializeControl: function(button){
Expand All @@ -875,22 +888,27 @@ JSClass("UIPopupButtonImageStyler", UIPopupButtonStyler, {
button._imageView.hidden = false;
button.cornerRadius = this.cornerRadius;
button.titleInsets = this.titleInsets;
button.borderWidth = this.borderWidth;
this.updateControl(button);
},

updateControl: function(button){
if (!button.enabled){
button._imageView.templateColor = this.disabledColor;
button.backgroundColor = this.normalBackgroundColor;
button.borderColor = this.normalBorderColor;
}else if (button.active){
button._imageView.templateColor = this.activeColor;
button.backgroundColor = this.activeBackgroundColor;
button.borderColor = this.activeBorderColor;
}else{
button._imageView.templateColor = this.normalColor;
if (this.showsOverState && button.over){
button.backgroundColor = this.overBackgroundColor;
button.borderColor = this.overBorderColor;
}else{
button.backgroundColor = this.normalBackgroundColor;
button.borderColor = this.normalBorderColor;
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions Frameworks/UIKit/UIWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,8 @@ JSClass("UIWindowDefaultStyler", UIWindowStyler, {
window.shadowRadius = this.shadowRadius;
window.cornerRadius = this.cornerRadius;
window.backgroundColor = this.backgroundColor;
window.borderWidth = 1;
window.borderColor = JSColor.windowBorder;

this.updateWindow(window);
},
Expand Down Expand Up @@ -1677,6 +1679,8 @@ JSClass("UIWindowTitlelessStyler", UIWindowStyler, {
window.shadowRadius = this.shadowRadius;
window.cornerRadius = this.cornerRadius;
window.backgroundColor = this.backgroundColor;
window.borderWidth = 1;
window.borderColor = JSColor.windowBorder;

this.updateWindow(window);
},
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/UIKitTesting/Info.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JSBundleType: framework
JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
JSBundleVersion: 2024.24.0
JSBundleVersion: 2024.25.0
JSDevelopmentLanguage: en
JSCopyright: Copyright © 2020 Breakside Inc.
JSLicenseNotice: |
Expand Down
Loading