Commit f66fe9eb19
Verified · cmc
Layout: unified · split
ios/Orgstar/Assets.xcassets/AppIcon-Forest.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Midnight.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Mono.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Org.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Outline.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Paper.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Rainbow.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Sunset.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Terminal.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Unicorn.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-UnicornNight.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-UnicornPastel.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-default.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-default.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-forest.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-forest.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-midnight.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-midnight.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-mono.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-mono.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-org.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-org.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-outline.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-outline.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-paper.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-paper.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-rainbow.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-rainbow.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-sunset.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-sunset.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-terminal.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-terminal.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-unicorn-night.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-unicorn-night.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-unicorn-pastel.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-unicorn-pastel.imageset/dark.png deleted
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-unicorn.imageset/Contents.json −10
| @@ -3,16 +3,6 @@ | |||
| 3 | { | 3 | { |
| 4 | "filename" : "light.png", | 4 | "filename" : "light.png", |
| 5 | "idiom" : "universal" | 5 | "idiom" : "universal" |
| 6 | }, | ||
| 7 | { | ||
| 8 | "appearances" : [ | ||
| 9 | { | ||
| 10 | "appearance" : "luminosity", | ||
| 11 | "value" : "dark" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "filename" : "dark.png", | ||
| 15 | "idiom" : "universal" | ||
| 16 | } | 6 | } |
| 17 | ], | 7 | ], |
| 18 | "info" : { | 8 | "info" : { |
ios/Orgstar/Assets.xcassets/IconPreview-unicorn.imageset/dark.png deleted
Binary file not shown.
packaging/IconPreviews/default-dark.png
Binary file not shown.
packaging/IconPreviews/forest-dark.png
Binary file not shown.
packaging/IconPreviews/midnight-dark.png
Binary file not shown.
packaging/IconPreviews/mono-dark.png
Binary file not shown.
packaging/IconPreviews/org-dark.png
Binary file not shown.
packaging/IconPreviews/outline-dark.png
Binary file not shown.
packaging/IconPreviews/paper-dark.png
Binary file not shown.
packaging/IconPreviews/rainbow-dark.png
Binary file not shown.
packaging/IconPreviews/sunset-dark.png
Binary file not shown.
packaging/IconPreviews/terminal-dark.png
Binary file not shown.
packaging/IconPreviews/unicorn-dark.png
Binary file not shown.
packaging/IconPreviews/unicorn-night-dark.png
Binary file not shown.
packaging/IconPreviews/unicorn-pastel-dark.png
Binary file not shown.
scripts/make-icon.swift +21 −20
| @@ -35,13 +35,12 @@ let variants: [Variant] = [ | |||
| 35 | Variant(id: "unicorn-pastel", top: rgb(0xffc6dd), bottom: rgb(0xc7b8ff), glyph: rgb(0xffc74d), bars: .white, style: .star), | 35 | Variant(id: "unicorn-pastel", top: rgb(0xffc6dd), bottom: rgb(0xc7b8ff), glyph: rgb(0xffc74d), bars: .white, style: .star), |
| 36 | ] | 36 | ] |
| 37 | 37 | ||
| 38 | /// `darkTile`: the dark look on a near-black tile, for the Mac's Dock, which draws nothing | 38 | /// `dark`: the icon's background darkened, so each icon keeps its color in the system's Dark |
| 39 | /// behind an icon set with `NSApp.applicationIconImage`. | 39 | /// icon style and the Mac's dark Dock; `tinted`: a grayscale glyph on black for the system to tint. |
| 40 | enum Look { case light, dark, darkTile, tinted } | 40 | enum Look { case light, dark, tinted } |
| 41 | 41 | ||
| 42 | /// The macOS icon grid: an 824-point rounded square in a 1024 canvas; `fullBleed` fills the | 42 | /// The macOS icon grid: an 824-point rounded square in a 1024 canvas; `fullBleed` fills the |
| 43 | /// canvas, as iOS wants. Dark and tinted leave the background clear (dark) or black (tinted) | 43 | /// canvas, as iOS wants. |
| 44 | /// for the system to fill. | ||
| 45 | func draw(_ v: Variant, _ size: CGFloat, look: Look = .light, fullBleed: Bool = false) -> NSBitmapImageRep { | 44 | func draw(_ v: Variant, _ size: CGFloat, look: Look = .light, fullBleed: Bool = false) -> NSBitmapImageRep { |
| 46 | let rep = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: Int(size), pixelsHigh: Int(size), bitsPerSample: 8, | 45 | let rep = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: Int(size), pixelsHigh: Int(size), bitsPerSample: 8, |
| 47 | samplesPerPixel: 4, hasAlpha: true, isPlanar: false, colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0)! | 46 | samplesPerPixel: 4, hasAlpha: true, isPlanar: false, colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0)! |
| @@ -56,26 +55,31 @@ func draw(_ v: Variant, _ size: CGFloat, look: Look = .light, fullBleed: Bool = | |||
| 56 | } | 55 | } |
| 57 | let square = NSRect(x: 100 * s, y: 100 * s, width: 824 * s, height: 824 * s) | 56 | let square = NSRect(x: 100 * s, y: 100 * s, width: 824 * s, height: 824 * s) |
| 58 | let shape = fullBleed ? NSBezierPath(rect: square) : NSBezierPath(roundedRect: square, xRadius: 185 * s, yRadius: 185 * s) | 57 | let shape = fullBleed ? NSBezierPath(rect: square) : NSBezierPath(roundedRect: square, xRadius: 185 * s, yRadius: 185 * s) |
| 58 | // The dark look's background: the light one's colors most of the way to black, light | ||
| 59 | // ones (Paper, Outline, Pastel) further, so every tile ends up about as dark. | ||
| 60 | func shade(_ color: NSColor) -> NSColor { | ||
| 61 | guard look == .dark, let c = color.usingColorSpace(.sRGB) else { return color } | ||
| 62 | let luminance = 0.2126 * c.redComponent + 0.7152 * c.greenComponent + 0.0722 * c.blueComponent | ||
| 63 | return c.blended(withFraction: luminance > 0.6 ? 0.8 : 0.7, of: .black)! | ||
| 64 | } | ||
| 59 | switch look { | 65 | switch look { |
| 60 | case .light where v.id == "rainbow": | 66 | case .light where v.id == "rainbow", .dark where v.id == "rainbow": |
| 61 | NSGraphicsContext.saveGraphicsState() | 67 | NSGraphicsContext.saveGraphicsState() |
| 62 | shape.addClip() | 68 | shape.addClip() |
| 63 | let stripes = [0xe40303, 0xff8c00, 0xffed00, 0x008026, 0x004dff, 0x750787].map(rgb) | 69 | let stripes = [0xe40303, 0xff8c00, 0xffed00, 0x008026, 0x004dff, 0x750787].map(rgb) |
| 64 | let band = square.height / CGFloat(stripes.count) | 70 | let band = square.height / CGFloat(stripes.count) |
| 65 | for (i, color) in stripes.enumerated() { | 71 | for (i, color) in stripes.enumerated() { |
| 66 | color.setFill() | 72 | shade(color).setFill() |
| 67 | NSRect(x: square.minX, y: square.maxY - band * CGFloat(i + 1), width: square.width, height: band).fill() | 73 | NSRect(x: square.minX, y: square.maxY - band * CGFloat(i + 1), width: square.width, height: band).fill() |
| 68 | } | 74 | } |
| 69 | NSGraphicsContext.restoreGraphicsState() | 75 | NSGraphicsContext.restoreGraphicsState() |
| 70 | case .light: NSGradient(colors: [v.top, v.bottom])!.draw(in: shape, angle: -60) | 76 | case .light, .dark: NSGradient(colors: [shade(v.top), shade(v.bottom)])!.draw(in: shape, angle: -60) |
| 71 | case .dark: break | ||
| 72 | case .darkTile: NSColor(srgbRed: 0.11, green: 0.11, blue: 0.12, alpha: 1).setFill(); shape.fill() | ||
| 73 | case .tinted: NSColor.black.setFill(); shape.fill() | 77 | case .tinted: NSColor.black.setFill(); shape.fill() |
| 74 | } | 78 | } |
| 75 | // On a dark background a dark glyph (Paper, Outline) is drawn light. | 79 | // On a dark background a dark or mid-tone glyph (Paper, Outline) is drawn light. |
| 76 | func lifted(_ color: NSColor, _ light: CGFloat) -> NSColor { | 80 | func lifted(_ color: NSColor, _ light: CGFloat) -> NSColor { |
| 77 | guard look == .dark || look == .darkTile, let c = color.usingColorSpace(.sRGB), | 81 | guard look == .dark, let c = color.usingColorSpace(.sRGB), |
| 78 | 0.2126 * c.redComponent + 0.7152 * c.greenComponent + 0.0722 * c.blueComponent < 0.4 else { return color } | 82 | 0.2126 * c.redComponent + 0.7152 * c.greenComponent + 0.0722 * c.blueComponent < 0.5 else { return color } |
| 79 | return NSColor(white: light, alpha: 1) | 83 | return NSColor(white: light, alpha: 1) |
| 80 | } | 84 | } |
| 81 | let glyph = look == .tinted ? NSColor(white: 0.95, alpha: 1) : lifted(v.glyph, 0.95) | 85 | let glyph = look == .tinted ? NSColor(white: 0.95, alpha: 1) : lifted(v.glyph, 0.95) |
| @@ -168,18 +172,15 @@ for v in variants { | |||
| 168 | } | 172 | } |
| 169 | try json(["images": images, "info": info], "\(set)/Contents.json") | 173 | try json(["images": images, "info": info], "\(set)/Contents.json") |
| 170 | 174 | ||
| 171 | // Previews for the iOS picker, light and dark. | 175 | // The iOS picker's preview: the icon in color in both appearances, so each can be told apart. |
| 172 | let preview = "ios/Orgstar/Assets.xcassets/IconPreview-\(v.id).imageset" | 176 | let preview = "ios/Orgstar/Assets.xcassets/IconPreview-\(v.id).imageset" |
| 177 | try? FileManager.default.removeItem(atPath: preview) | ||
| 173 | try write(png(draw(v, 256, fullBleed: true)), "\(preview)/light.png") | 178 | try write(png(draw(v, 256, fullBleed: true)), "\(preview)/light.png") |
| 174 | try write(png(draw(v, 256, look: .dark, fullBleed: true)), "\(preview)/dark.png") | 179 | try json(["images": [["filename": "light.png", "idiom": "universal"]], "info": info], "\(preview)/Contents.json") |
| 175 | try json(["images": [ | ||
| 176 | ["filename": "light.png", "idiom": "universal"], | ||
| 177 | ["filename": "dark.png", "idiom": "universal", "appearances": [["appearance": "luminosity", "value": "dark"]]], | ||
| 178 | ], "info": info], "\(preview)/Contents.json") | ||
| 179 | 180 | ||
| 180 | // The Mac's Dock icons and picker previews. | 181 | // The Mac's Dock icons and picker previews. |
| 181 | try write(png(draw(v, 512)), "packaging/IconPreviews/\(v.id)-light.png") | 182 | try write(png(draw(v, 512)), "packaging/IconPreviews/\(v.id)-light.png") |
| 182 | try write(png(draw(v, 512, look: .darkTile)), "packaging/IconPreviews/\(v.id)-dark.png") | 183 | try write(png(draw(v, 512, look: .dark)), "packaging/IconPreviews/\(v.id)-dark.png") |
| 183 | } | 184 | } |
| 184 | 185 | ||
| 185 | // The Mac's bundle icon: the default variant at the Mac's sizes. actool drops dark and | 186 | // The Mac's bundle icon: the default variant at the Mac's sizes. actool drops dark and |