Skip to content

Commit

Permalink
ios: Add "Brand" color set.
Browse files Browse the repository at this point in the history
In a recent commit, we bumped the deployment target to 11.0, in
order to handle a new feature: named colors [1] [2] [3] [4].

Now, add a color-set for the brand color, to be used in two places
so far (in upcoming commits):

- the iOS launch screen

- the background color of `rootView.loadingView` in `AppDelegate.m`

On iOS, it's easy to slightly mismatch the colors in the splash
screen with the colors you use in the app, even if you give them
equivalent definitions [5]. This is a move toward standardizing the
brand color on iOS, to hopefully avoid that -- or, in any case, to
reduce duplication of important color definitions.

We don't yet send the color definition over the bridge and use it in
our JavaScript, but we're hoping React Native v0.63's
`PlatformColor` API [6] will let us do that easily, and we're hoping
that will eliminate any issue. My eyes don't detect any difference
between the HSL-defined color as it appears in the `LoadingScreen`
background, and this RGB-defined color (HSL being apparently
unavailable on the native side; I used an online converter) as it
appears in the updated launch screen a few commits from now.

[1] A pre-official release of Xcode 11 reportedly had a bug with
    this feature; see
    https://developer.apple.com/forums/thread/122661. The discussion
    there suggests that the bug was fixed in the "GM Seed 2" release
    for Xcode 11, and the build number for that release is the same
    as the build number for the official release
    (https://xcodereleases.com/). So we should be fine even if we
    use Xcode 11, which we don't (or I don't, anyway; I'm on 12).

[2] https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_ref-Asset_Catalog_Format/Named_Color.html

[3] https://developer.apple.com/documentation/uikit/uicolor/2877380-colornamed?language=objc

[4] https://devblog.xero.com/managing-ui-colours-with-ios-11-asset-catalogs-16500ba48205

[5] E.g., expo/expo#826

[6] https://reactnative.dev/docs/platformcolor
  • Loading branch information
chrisbobbe committed Oct 22, 2020
1 parent 51551d3 commit 86843a1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ios/ZulipMobile/Assets.xcassets/Brand.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xAF",
"green" : "0xC2",
"red" : "0x51"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

0 comments on commit 86843a1

Please sign in to comment.