Star icons in place of the unicorns !350
25 files changed, +60 −49
Layout: unified · split
Sources/OrgPresentation/AppIcons.swift +4 −3
| @@ -19,9 +19,10 @@ public enum AppIcons { | |||
| 19 | case "forest": String(localized: "Forest") | 19 | case "forest": String(localized: "Forest") |
| 20 | case "rainbow": String(localized: "Rainbow") | 20 | case "rainbow": String(localized: "Rainbow") |
| 21 | case "outline": String(localized: "Outline") | 21 | case "outline": String(localized: "Outline") |
| 22 | case "unicorn": String(localized: "Unicorn") | 22 | // Ids from when these were unicorns, kept so an icon chosen then stays chosen. |
| 23 | case "unicorn-night": String(localized: "Unicorn Night") | 23 | case "unicorn": String(localized: "Org Star") |
| 24 | case "unicorn-pastel": String(localized: "Unicorn Pastel") | 24 | case "unicorn-night": String(localized: "Night Star") |
| 25 | case "unicorn-pastel": String(localized: "Pastel Star") | ||
| 25 | default: words(id).joined(separator: " ") | 26 | default: words(id).joined(separator: " ") |
| 26 | } | 27 | } |
| 27 | } | 28 | } |
Tests/OrgPresentationTests/PaletteTests.swift +1 −1
| @@ -92,7 +92,7 @@ struct PaletteTests { | |||
| 92 | #expect(AppIcons.alternateName("unicorn-night") == "AppIcon-UnicornNight") | 92 | #expect(AppIcons.alternateName("unicorn-night") == "AppIcon-UnicornNight") |
| 93 | #expect(AppIcons.id(alternateName: "AppIcon-UnicornNight") == "unicorn-night") | 93 | #expect(AppIcons.id(alternateName: "AppIcon-UnicornNight") == "unicorn-night") |
| 94 | #expect(AppIcons.id(alternateName: nil) == "default" && AppIcons.id(alternateName: "AppIcon-Gone") == "default") | 94 | #expect(AppIcons.id(alternateName: nil) == "default" && AppIcons.id(alternateName: "AppIcon-Gone") == "default") |
| 95 | #expect(AppIcons.name("unicorn-pastel") == "Unicorn Pastel") | 95 | #expect(AppIcons.name("unicorn") == "Org Star" && AppIcons.name("unicorn-night") == "Night Star" && AppIcons.name("unicorn-pastel") == "Pastel Star") |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | @Test func dockFilesFollowTheAppearance() { | 98 | @Test func dockFilesFollowTheAppearance() { |
ios/Orgstar/Assets.xcassets/AppIcon-Unicorn.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Unicorn.appiconset/AppIcon-tinted.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-Unicorn.appiconset/AppIcon.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-UnicornNight.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-UnicornNight.appiconset/AppIcon-tinted.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-UnicornNight.appiconset/AppIcon.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-UnicornPastel.appiconset/AppIcon-dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-UnicornPastel.appiconset/AppIcon-tinted.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon-UnicornPastel.appiconset/AppIcon.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-unicorn-night.imageset/dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-unicorn-night.imageset/light.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-unicorn-pastel.imageset/dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-unicorn-pastel.imageset/light.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-unicorn.imageset/dark.png
Binary file not shown.
ios/Orgstar/Assets.xcassets/IconPreview-unicorn.imageset/light.png
Binary file not shown.
l10n/Localizable.xcstrings +33
| @@ -3302,6 +3302,16 @@ | |||
| 3302 | } | 3302 | } |
| 3303 | } | 3303 | } |
| 3304 | }, | 3304 | }, |
| 3305 | "Night Star": { | ||
| 3306 | "localizations": { | ||
| 3307 | "de": { | ||
| 3308 | "stringUnit": { | ||
| 3309 | "state": "translated", | ||
| 3310 | "value": "Nachtstern" | ||
| 3311 | } | ||
| 3312 | } | ||
| 3313 | } | ||
| 3314 | }, | ||
| 3305 | "No Emacs configuration found": { | 3315 | "No Emacs configuration found": { |
| 3306 | "localizations": { | 3316 | "localizations": { |
| 3307 | "de": { | 3317 | "de": { |
| @@ -3766,6 +3776,16 @@ | |||
| 3766 | "Org": { | 3776 | "Org": { |
| 3767 | "shouldTranslate": false | 3777 | "shouldTranslate": false |
| 3768 | }, | 3778 | }, |
| 3779 | "Org Star": { | ||
| 3780 | "localizations": { | ||
| 3781 | "de": { | ||
| 3782 | "stringUnit": { | ||
| 3783 | "state": "translated", | ||
| 3784 | "value": "Org-Stern" | ||
| 3785 | } | ||
| 3786 | } | ||
| 3787 | } | ||
| 3788 | }, | ||
| 3769 | "Org's date syntax works too: +2d, fri, 14:00": { | 3789 | "Org's date syntax works too: +2d, fri, 14:00": { |
| 3770 | "localizations": { | 3790 | "localizations": { |
| 3771 | "de": { | 3791 | "de": { |
| @@ -3869,6 +3889,16 @@ | |||
| 3869 | } | 3889 | } |
| 3870 | } | 3890 | } |
| 3871 | }, | 3891 | }, |
| 3892 | "Pastel Star": { | ||
| 3893 | "localizations": { | ||
| 3894 | "de": { | ||
| 3895 | "stringUnit": { | ||
| 3896 | "state": "translated", | ||
| 3897 | "value": "Pastellstern" | ||
| 3898 | } | ||
| 3899 | } | ||
| 3900 | } | ||
| 3901 | }, | ||
| 3872 | "Pause Timer": { | 3902 | "Pause Timer": { |
| 3873 | "localizations": { | 3903 | "localizations": { |
| 3874 | "de": { | 3904 | "de": { |
| @@ -5574,6 +5604,7 @@ | |||
| 5574 | } | 5604 | } |
| 5575 | }, | 5605 | }, |
| 5576 | "Unicorn": { | 5606 | "Unicorn": { |
| 5607 | "extractionState": "stale", | ||
| 5577 | "localizations": { | 5608 | "localizations": { |
| 5578 | "de": { | 5609 | "de": { |
| 5579 | "stringUnit": { | 5610 | "stringUnit": { |
| @@ -5584,6 +5615,7 @@ | |||
| 5584 | } | 5615 | } |
| 5585 | }, | 5616 | }, |
| 5586 | "Unicorn Night": { | 5617 | "Unicorn Night": { |
| 5618 | "extractionState": "stale", | ||
| 5587 | "localizations": { | 5619 | "localizations": { |
| 5588 | "de": { | 5620 | "de": { |
| 5589 | "stringUnit": { | 5621 | "stringUnit": { |
| @@ -5594,6 +5626,7 @@ | |||
| 5594 | } | 5626 | } |
| 5595 | }, | 5627 | }, |
| 5596 | "Unicorn Pastel": { | 5628 | "Unicorn Pastel": { |
| 5629 | "extractionState": "stale", | ||
| 5597 | "localizations": { | 5630 | "localizations": { |
| 5598 | "de": { | 5631 | "de": { |
| 5599 | "stringUnit": { | 5632 | "stringUnit": { |
packaging/IconPreviews/unicorn-dark.png
Binary file not shown.
packaging/IconPreviews/unicorn-light.png
Binary file not shown.
packaging/IconPreviews/unicorn-night-dark.png
Binary file not shown.
packaging/IconPreviews/unicorn-night-light.png
Binary file not shown.
packaging/IconPreviews/unicorn-pastel-dark.png
Binary file not shown.
packaging/IconPreviews/unicorn-pastel-light.png
Binary file not shown.
scripts/make-icon.swift +22 −45
| @@ -5,7 +5,7 @@ | |||
| 5 | import AppKit | 5 | import AppKit |
| 6 | 6 | ||
| 7 | struct Variant { | 7 | struct Variant { |
| 8 | enum Style { case filled, outline, unicorn } | 8 | enum Style { case filled, outline, star } |
| 9 | let id: String | 9 | let id: String |
| 10 | /// The gradient, top-left to bottom-right. | 10 | /// The gradient, top-left to bottom-right. |
| 11 | let top: NSColor, bottom: NSColor | 11 | let top: NSColor, bottom: NSColor |
| @@ -30,9 +30,9 @@ let variants: [Variant] = [ | |||
| 30 | Variant(id: "rainbow", top: rgb(0xe40303), bottom: rgb(0x732982), glyph: .white, bars: NSColor(white: 1, alpha: 0.9)), | 30 | Variant(id: "rainbow", top: rgb(0xe40303), bottom: rgb(0x732982), glyph: .white, bars: NSColor(white: 1, alpha: 0.9)), |
| 31 | Variant(id: "outline", top: .white, bottom: rgb(0xf2f2f2), glyph: rgb(0x2f5486), bars: rgb(0x2f5486), style: .outline), | 31 | Variant(id: "outline", top: .white, bottom: rgb(0xf2f2f2), glyph: rgb(0x2f5486), bars: rgb(0x2f5486), style: .outline), |
| 32 | Variant(id: "terminal", top: rgb(0x0a0f0a), bottom: .black, glyph: rgb(0x39ff6a), bars: rgb(0x2bcc55)), | 32 | Variant(id: "terminal", top: rgb(0x0a0f0a), bottom: .black, glyph: rgb(0x39ff6a), bars: rgb(0x2bcc55)), |
| 33 | Variant(id: "unicorn", top: rgb(0x77aa99), bottom: rgb(0x3e7a6a), glyph: rgb(0xffc74d), bars: .white, style: .unicorn), | 33 | Variant(id: "unicorn", top: rgb(0x77aa99), bottom: rgb(0x3e7a6a), glyph: rgb(0xffc74d), bars: .white, style: .star), |
| 34 | Variant(id: "unicorn-night", top: rgb(0x2b2a6b), bottom: rgb(0x14133a), glyph: rgb(0xd8dde6), bars: rgb(0xeae8ff), style: .unicorn), | 34 | Variant(id: "unicorn-night", top: rgb(0x2b2a6b), bottom: rgb(0x14133a), glyph: rgb(0xd8dde6), bars: rgb(0xeae8ff), style: .star), |
| 35 | Variant(id: "unicorn-pastel", top: rgb(0xffc6dd), bottom: rgb(0xc7b8ff), glyph: rgb(0xffc74d), bars: .white, style: .unicorn), | 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 | /// `darkTile`: the dark look on a near-black tile, for the Mac's Dock, which draws nothing |
| @@ -83,7 +83,7 @@ func draw(_ v: Variant, _ size: CGFloat, look: Look = .light, fullBleed: Bool = | |||
| 83 | switch v.style { | 83 | switch v.style { |
| 84 | case .filled: drawOutline(s, glyph: glyph, bars: bars, filled: true) | 84 | case .filled: drawOutline(s, glyph: glyph, bars: bars, filled: true) |
| 85 | case .outline: drawOutline(s, glyph: glyph, bars: bars, filled: false) | 85 | case .outline: drawOutline(s, glyph: glyph, bars: bars, filled: false) |
| 86 | case .unicorn: drawUnicorn(s, glyph: glyph, head: bars) | 86 | case .star: drawStar(s, glyph: glyph) |
| 87 | } | 87 | } |
| 88 | NSGraphicsContext.restoreGraphicsState() | 88 | NSGraphicsContext.restoreGraphicsState() |
| 89 | return rep | 89 | return rep |
| @@ -107,46 +107,23 @@ func drawOutline(_ s: CGFloat, glyph: NSColor, bars: NSColor, filled: Bool) { | |||
| 107 | } | 107 | } |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | /// A unicorn's head in profile, facing left, with a mane; its horn ends in the heading star. | 110 | /// The heading star alone, filling the tile: the glyph's outline, centred and scaled to fit. |
| 111 | func drawUnicorn(_ s: CGFloat, glyph: NSColor, head: NSColor) { | 111 | func drawStar(_ s: CGFloat, glyph: NSColor) { |
| 112 | func p(_ x: CGFloat, _ y: CGFloat) -> NSPoint { NSPoint(x: x * s, y: y * s) } | 112 | // The font the system draws ✱ in; the system font itself has no such glyph. |
| 113 | let face = NSBezierPath() | 113 | let font = CTFontCreateForString(NSFont.systemFont(ofSize: 100, weight: .heavy) as CTFont, "✱" as CFString, CFRange(location: 0, length: 1)) |
| 114 | face.move(to: p(640, 200)) // neck, back | 114 | var character: UniChar = 0x2731 |
| 115 | face.curve(to: p(600, 560), controlPoint1: p(700, 330), controlPoint2: p(690, 480)) | 115 | var glyphID: CGGlyph = 0 |
| 116 | face.curve(to: p(470, 640), controlPoint1: p(560, 610), controlPoint2: p(520, 640)) // crown | 116 | CTFontGetGlyphsForCharacters(font, &character, &glyphID, 1) |
| 117 | face.line(to: p(440, 690)) // ear | 117 | guard let outline = CTFontCreatePathForGlyph(font, glyphID, nil) else { return } |
| 118 | face.line(to: p(410, 620)) | 118 | let bounds = outline.boundingBoxOfPath |
| 119 | face.curve(to: p(250, 470), controlPoint1: p(340, 590), controlPoint2: p(270, 530)) // brow to nose | 119 | let scale = 560 * s / max(bounds.width, bounds.height) |
| 120 | face.curve(to: p(290, 400), controlPoint1: p(235, 430), controlPoint2: p(250, 400)) // muzzle | 120 | var transform = CGAffineTransform(translationX: 512 * s, y: 512 * s) |
| 121 | face.curve(to: p(430, 430), controlPoint1: p(340, 400), controlPoint2: p(390, 410)) // jaw | 121 | .scaledBy(x: scale, y: scale) |
| 122 | face.curve(to: p(450, 200), controlPoint1: p(470, 360), controlPoint2: p(440, 280)) // throat | 122 | .translatedBy(x: -bounds.midX, y: -bounds.midY) |
| 123 | face.close() | 123 | guard let placed = outline.copy(using: &transform), let context = NSGraphicsContext.current?.cgContext else { return } |
| 124 | head.setFill() | 124 | context.addPath(placed) |
| 125 | face.fill() | 125 | context.setFillColor(glyph.cgColor) |
| 126 | 126 | context.fillPath() | |
| 127 | let mane = NSBezierPath() | ||
| 128 | mane.move(to: p(600, 560)) | ||
| 129 | mane.curve(to: p(760, 220), controlPoint1: p(720, 520), controlPoint2: p(800, 360)) | ||
| 130 | mane.line(to: p(690, 210)) | ||
| 131 | mane.curve(to: p(600, 520), controlPoint1: p(730, 330), controlPoint2: p(680, 470)) | ||
| 132 | mane.close() | ||
| 133 | glyph.withAlphaComponent(0.85).setFill() | ||
| 134 | mane.fill() | ||
| 135 | |||
| 136 | let horn = NSBezierPath() | ||
| 137 | horn.move(to: p(440, 640)) | ||
| 138 | horn.line(to: p(300, 790)) | ||
| 139 | horn.line(to: p(475, 660)) | ||
| 140 | horn.close() | ||
| 141 | head.blended(withFraction: 0.25, of: glyph)?.setFill() | ||
| 142 | horn.fill() | ||
| 143 | |||
| 144 | let eye = NSBezierPath(ovalIn: NSRect(x: 360 * s, y: 520 * s, width: 28 * s, height: 28 * s)) | ||
| 145 | NSColor(white: 0.15, alpha: 1).setFill() | ||
| 146 | eye.fill() | ||
| 147 | |||
| 148 | let star = NSAttributedString(string: "✱", attributes: [.font: NSFont.systemFont(ofSize: 190 * s, weight: .heavy), .foregroundColor: glyph]) | ||
| 149 | star.draw(at: p(205, 700)) | ||
| 150 | } | 127 | } |
| 151 | 128 | ||
| 152 | func png(_ rep: NSBitmapImageRep) -> Data { rep.representation(using: .png, properties: [:])! } | 129 | func png(_ rep: NSBitmapImageRep) -> Data { rep.representation(using: .png, properties: [:])! } |