Skip to content

armgit / soju

Public Imported from GitHub
0

Play Windows games on Apple Silicon Macs. Free, open-source app that installs the official Battle.net, Steam, Epic and GOG launchers and lists your games in one library.

App icon: hand-drawn soju bottle and shot glass clinking, pen lines on paper

mikey9245a46acdbaa3
diff --git a/app/Icon.swift b/app/Icon.swift
index aabe51bf82c..cd816a03054 100644
--- a/app/Icon.swift
+++ b/app/Icon.swift
@@ -1,6 +1,6 @@
import AppKit
-// App icon: a green soju bottle and a filled shot glass on a deep navy tile.
-// Drawn as vectors so every size of the iconset stays sharp. Usage: swift Icon.swift <out dir>
+// App icon: a hand-drawn soju bottle and shot glass clinking ("jjan"), pen lines on warm paper,
+// colour laid slightly off the lines like a quick marker sketch. Usage: swift Icon.swift <out dir>
let output = CommandLine.arguments[1]
let dir = URL(fileURLWithPath: output).appendingPathComponent("Soju.iconset")
try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
@@ -9,90 +9,164 @@ func rgb(_ r: CGFloat, _ g: CGFloat, _ b: CGFloat, _ a: CGFloat = 1) -> NSColor
NSColor(calibratedRed: r, green: g, blue: b, alpha: a)
}
+// small deterministic random so every size gets the same wobble
+struct Rand {
+ var s: UInt64
+ mutating func next() -> CGFloat {
+ s = s &* 6364136223846793005 &+ 1442695040888963407
+ return CGFloat((s >> 33) % 100000) / 100000.0
+ }
+}
+
+let INK = rgb(0.13, 0.12, 0.11)
+
+/// A hand-drawn line through `pts` (unit coordinates, y up): resampled, nudged sideways by a
+/// slow wobble, then smoothed with Catmull-Rom so it reads like a pen line, not a vector path.
+func pen(_ pts: [CGPoint], _ n: CGFloat, closed: Bool, seed: UInt64, wobble: CGFloat = 0.006) -> NSBezierPath {
+ var r = Rand(s: seed)
+ var src = pts
+ if closed { src.append(pts[0]) }
+ var out: [CGPoint] = []
+ let phase1 = r.next() * 6.28, phase2 = r.next() * 6.28
+ var dist: CGFloat = 0
+ for i in 0..<(src.count - 1) {
+ let a = src[i], b = src[i + 1]
+ let len = hypot(b.x - a.x, b.y - a.y)
+ let steps = max(2, Int(len / 0.025))
+ for k in 0..<steps {
+ let t = CGFloat(k) / CGFloat(steps)
+ let x = a.x + (b.x - a.x) * t, y = a.y + (b.y - a.y) * t
+ let nx = -(b.y - a.y) / max(len, 0.0001), ny = (b.x - a.x) / max(len, 0.0001)
+ let w = wobble * (sin(dist * 23 + phase1) * 0.6 + sin(dist * 61 + phase2) * 0.4)
+ out.append(CGPoint(x: (x + nx * w) * n, y: (y + ny * w) * n))
+ dist += len / CGFloat(steps)
+ }
+ }
+ if !closed, let last = src.last { out.append(CGPoint(x: last.x * n, y: last.y * n)) }
+ if closed { out.append(out[0]); out.append(out[1]) }
+ let p = NSBezierPath()
+ p.move(to: out[0])
+ for i in 1..<(out.count - 1) {
+ let p0 = out[max(0, i - 2)], p1 = out[i - 1], p2 = out[i], p3 = out[min(out.count - 1, i + 1)]
+ p.curve(to: p2, controlPoint1: CGPoint(x: p1.x + (p2.x - p0.x) / 6, y: p1.y + (p2.y - p0.y) / 6),
+ controlPoint2: CGPoint(x: p2.x - (p3.x - p1.x) / 6, y: p2.y - (p3.y - p1.y) / 6))
+ }
+ if closed { p.close() }
+ p.lineCapStyle = .round
+ p.lineJoinStyle = .round
+ return p
+}
+
+func ink(_ p: NSBezierPath, _ n: CGFloat, width: CGFloat = 0.024) {
+ INK.setStroke()
+ // fine pen at full size; small icons keep the heavier line so the shapes still read
+ let w = n >= 256 ? width * 0.72 : width
+ p.lineWidth = max(1.2, n * w)
+ p.stroke()
+}
+
+func rotate(_ pts: [CGPoint], by deg: CGFloat, around c: CGPoint) -> [CGPoint] {
+ let a = deg * .pi / 180
+ return pts.map { p in
+ let dx = p.x - c.x, dy = p.y - c.y
+ return CGPoint(x: c.x + dx * cos(a) - dy * sin(a), y: c.y + dx * sin(a) + dy * cos(a))
+ }
+}
+
+func shifted(_ p: NSBezierPath, _ dx: CGFloat, _ dy: CGFloat) -> NSBezierPath {
+ let q = p.copy() as! NSBezierPath
+ q.transform(using: AffineTransform(translationByX: dx, byY: dy))
+ return q
+}
+
+func dot(_ c: CGPoint, _ r: CGFloat, _ n: CGFloat, _ color: NSColor = INK) {
+ color.setFill()
+ NSBezierPath(ovalIn: NSRect(x: (c.x - r) * n, y: (c.y - r) * n, width: r * 2 * n, height: r * 2 * n)).fill()
+}
+
+func sparkle(_ c: CGPoint, _ s: CGFloat, _ n: CGFloat, seed: UInt64) {
+ // a four-point doodle star
+ let pts = [CGPoint(x: c.x, y: c.y + s), CGPoint(x: c.x + s * 0.22, y: c.y + s * 0.22), CGPoint(x: c.x + s, y: c.y),
+ CGPoint(x: c.x + s * 0.22, y: c.y - s * 0.22), CGPoint(x: c.x, y: c.y - s), CGPoint(x: c.x - s * 0.22, y: c.y - s * 0.22),
+ CGPoint(x: c.x - s, y: c.y), CGPoint(x: c.x - s * 0.22, y: c.y + s * 0.22)]
+ ink(pen(pts, n, closed: true, seed: seed, wobble: 0.002), n, width: 0.016)
+}
+
func draw(_ n: CGFloat) {
- // tile
+ // paper tile
let tile = NSBezierPath(roundedRect: NSRect(x: n * 0.08, y: n * 0.08, width: n * 0.84, height: n * 0.84),
xRadius: n * 0.2, yRadius: n * 0.2)
- NSGradient(starting: rgb(0.13, 0.19, 0.31), ending: rgb(0.06, 0.09, 0.16))!.draw(in: tile, angle: -90)
+ rgb(0.975, 0.965, 0.935).setFill()
+ tile.fill()
NSGraphicsContext.saveGraphicsState()
tile.addClip()
- // soft light behind the bottle
- let glow = NSBezierPath(ovalIn: NSRect(x: n * 0.12, y: n * 0.22, width: n * 0.62, height: n * 0.62))
- NSGradient(starting: rgb(0.35, 0.75, 0.55, 0.28), ending: rgb(0.35, 0.75, 0.55, 0))!.draw(in: glow, relativeCenterPosition: .zero)
+ var grain = Rand(s: 7)
+ for _ in 0..<Int(n * 1.2) { // a little paper tooth
+ let x = grain.next(), y = grain.next(), a = 0.03 + grain.next() * 0.05
+ rgb(0.55, 0.5, 0.42, a).setFill()
+ NSBezierPath(rect: NSRect(x: x * n, y: y * n, width: max(1, n * 0.003), height: max(1, n * 0.003))).fill()
+ }
- // bottle: body, shoulder, neck, cap
- let bx = n * 0.25, bw = n * 0.28, by = n * 0.16, bh = n * 0.42
- let body = NSBezierPath()
- let neckW = bw * 0.36, neckX = bx + (bw - neckW) / 2
- body.move(to: NSPoint(x: bx + n * 0.03, y: by))
- body.line(to: NSPoint(x: bx + bw - n * 0.03, y: by))
- body.curve(to: NSPoint(x: bx + bw, y: by + n * 0.03), controlPoint1: NSPoint(x: bx + bw, y: by), controlPoint2: NSPoint(x: bx + bw, y: by))
- body.line(to: NSPoint(x: bx + bw, y: by + bh))
- body.curve(to: NSPoint(x: neckX + neckW, y: by + bh + n * 0.13),
- controlPoint1: NSPoint(x: bx + bw, y: by + bh + n * 0.07), controlPoint2: NSPoint(x: neckX + neckW, y: by + bh + n * 0.06))
- body.line(to: NSPoint(x: neckX + neckW, y: by + bh + n * 0.22))
- body.line(to: NSPoint(x: neckX, y: by + bh + n * 0.22))
- body.line(to: NSPoint(x: neckX, y: by + bh + n * 0.13))
- body.curve(to: NSPoint(x: bx, y: by + bh),
- controlPoint1: NSPoint(x: neckX, y: by + bh + n * 0.06), controlPoint2: NSPoint(x: bx, y: by + bh + n * 0.07))
- body.line(to: NSPoint(x: bx, y: by + n * 0.03))
- body.curve(to: NSPoint(x: bx + n * 0.03, y: by), controlPoint1: NSPoint(x: bx, y: by), controlPoint2: NSPoint(x: bx, y: by))
- body.close()
- NSGradient(colors: [rgb(0.10, 0.45, 0.27), rgb(0.27, 0.72, 0.46), rgb(0.12, 0.50, 0.30)])!.draw(in: body, angle: 0)
- rgb(0.05, 0.25, 0.15, 0.9).setStroke()
- body.lineWidth = max(1, n * 0.008)
- body.stroke()
+ let small = n < 64
+
+ // --- bottle, leaning in toward the glass ---
+ let bc = CGPoint(x: 0.40, y: 0.47)
+ let bottle = rotate([
+ CGPoint(x: 0.31, y: 0.20), CGPoint(x: 0.49, y: 0.20), CGPoint(x: 0.50, y: 0.24), CGPoint(x: 0.50, y: 0.55),
+ CGPoint(x: 0.47, y: 0.62), CGPoint(x: 0.435, y: 0.67), CGPoint(x: 0.435, y: 0.77),
+ CGPoint(x: 0.365, y: 0.77), CGPoint(x: 0.365, y: 0.67), CGPoint(x: 0.33, y: 0.62), CGPoint(x: 0.30, y: 0.55),
+ CGPoint(x: 0.30, y: 0.24)], by: -14, around: bc)
+ let bottleLine = pen(bottle, n, closed: true, seed: 11)
+ // marker colour laid a little off the line
+ rgb(0.55, 0.82, 0.58).setFill()
+ shifted(pen(bottle, n, closed: true, seed: 12, wobble: 0.01), n * 0.014, -n * 0.012).fill()
// cap
- let cap = NSBezierPath(roundedRect: NSRect(x: neckX - n * 0.006, y: by + bh + n * 0.21, width: neckW + n * 0.012, height: n * 0.06),
- xRadius: n * 0.012, yRadius: n * 0.012)
- NSGradient(starting: rgb(0.20, 0.62, 0.38), ending: rgb(0.08, 0.38, 0.22))!.draw(in: cap, angle: -90)
- // label
- let label = NSBezierPath(roundedRect: NSRect(x: bx + n * 0.015, y: by + bh * 0.28, width: bw - n * 0.03, height: bh * 0.36),
- xRadius: n * 0.015, yRadius: n * 0.015)
- rgb(0.95, 0.97, 0.98).setFill()
- label.fill()
- rgb(0.20, 0.42, 0.78).setFill()
- NSBezierPath(rect: NSRect(x: bx + n * 0.015, y: by + bh * 0.28, width: bw - n * 0.03, height: bh * 0.06)).fill()
- if n >= 64 {
- let s = NSAttributedString(string: "소주", attributes: [
- .font: NSFont.systemFont(ofSize: n * 0.065, weight: .heavy), .foregroundColor: rgb(0.12, 0.34, 0.62)])
- let ss = s.size()
- s.draw(at: NSPoint(x: bx + (bw - ss.width) / 2, y: by + bh * 0.39))
+ let cap = rotate([CGPoint(x: 0.36, y: 0.77), CGPoint(x: 0.44, y: 0.77), CGPoint(x: 0.44, y: 0.83), CGPoint(x: 0.36, y: 0.83)], by: -14, around: bc)
+ rgb(0.30, 0.62, 0.42).setFill()
+ shifted(pen(cap, n, closed: true, seed: 13), n * 0.01, -n * 0.008).fill()
+ ink(bottleLine, n)
+ ink(pen(cap, n, closed: true, seed: 14), n)
+ // label with a face
+ let label = rotate([CGPoint(x: 0.32, y: 0.32), CGPoint(x: 0.48, y: 0.32), CGPoint(x: 0.48, y: 0.47), CGPoint(x: 0.32, y: 0.47)], by: -14, around: bc)
+ rgb(1, 1, 0.98).setFill()
+ pen(label, n, closed: true, seed: 15).fill()
+ ink(pen(label, n, closed: true, seed: 16), n, width: 0.018)
+ if !small {
+ let face = rotate([CGPoint(x: 0.365, y: 0.41), CGPoint(x: 0.435, y: 0.41), CGPoint(x: 0.40, y: 0.375)], by: -14, around: bc)
+ dot(face[0], 0.012, n); dot(face[1], 0.012, n)
+ let smile = rotate([CGPoint(x: 0.385, y: 0.375), CGPoint(x: 0.40, y: 0.362), CGPoint(x: 0.415, y: 0.375)], by: -14, around: bc)
+ ink(pen(smile, n, closed: false, seed: 17, wobble: 0.001), n, width: 0.014)
+ let blush = rotate([CGPoint(x: 0.345, y: 0.385), CGPoint(x: 0.455, y: 0.385)], by: -14, around: bc)
+ dot(blush[0], 0.014, n, rgb(0.97, 0.6, 0.62, 0.85)); dot(blush[1], 0.014, n, rgb(0.97, 0.6, 0.62, 0.85))
+ // highlight stroke on the glass of the bottle
+ let hi = rotate([CGPoint(x: 0.325, y: 0.50), CGPoint(x: 0.325, y: 0.57)], by: -14, around: bc)
+ rgb(1, 1, 1, 0.9).setStroke()
+ let h = pen(hi, n, closed: false, seed: 18, wobble: 0.001); h.lineWidth = n * 0.018; h.stroke()
}
- // highlight
- rgb(1, 1, 1, 0.32).setFill()
- NSBezierPath(roundedRect: NSRect(x: bx + bw * 0.14, y: by + n * 0.03, width: bw * 0.09, height: bh * 0.82),
- xRadius: n * 0.01, yRadius: n * 0.01).fill()
- // shot glass, front right, filled
- let gx = n * 0.555, gy = n * 0.16, gw = n * 0.18, gh = n * 0.19
- let glass = NSBezierPath()
- glass.move(to: NSPoint(x: gx + gw * 0.12, y: gy))
- glass.line(to: NSPoint(x: gx + gw * 0.88, y: gy))
- glass.line(to: NSPoint(x: gx + gw, y: gy + gh))
- glass.line(to: NSPoint(x: gx, y: gy + gh))
- glass.close()
- rgb(0.85, 0.93, 1.0, 0.22).setFill()
- glass.fill()
- // liquid
- let lh = gh * 0.62
- let liquid = NSBezierPath()
- liquid.move(to: NSPoint(x: gx + gw * 0.15, y: gy + gh * 0.08))
- liquid.line(to: NSPoint(x: gx + gw * 0.85, y: gy + gh * 0.08))
- liquid.line(to: NSPoint(x: gx + gw * 0.85 + gw * 0.12 * (lh / gh), y: gy + lh))
- liquid.line(to: NSPoint(x: gx + gw * 0.15 - gw * 0.12 * (lh / gh), y: gy + lh))
- liquid.close()
- rgb(0.80, 0.95, 0.92, 0.75).setFill()
- liquid.fill()
- // thick glass base
- rgb(0.90, 0.96, 1.0, 0.55).setFill()
- NSBezierPath(rect: NSRect(x: gx + gw * 0.13, y: gy, width: gw * 0.74, height: gh * 0.08)).fill()
- rgb(0.92, 0.97, 1.0, 0.95).setStroke()
- glass.lineWidth = max(1, n * 0.01)
- glass.stroke()
- // rim shine
- rgb(1, 1, 1, 0.6).setFill()
- NSBezierPath(rect: NSRect(x: gx + gw * 0.08, y: gy + gh * 0.2, width: gw * 0.06, height: gh * 0.6)).fill()
+ // --- shot glass, leaning back toward the bottle ---
+ let gc = CGPoint(x: 0.66, y: 0.30)
+ let glass = rotate([CGPoint(x: 0.585, y: 0.40), CGPoint(x: 0.735, y: 0.40), CGPoint(x: 0.715, y: 0.20), CGPoint(x: 0.605, y: 0.20)], by: 10, around: gc)
+ let liquid = rotate([CGPoint(x: 0.595, y: 0.34), CGPoint(x: 0.725, y: 0.34), CGPoint(x: 0.712, y: 0.215), CGPoint(x: 0.608, y: 0.215)], by: 10, around: gc)
+ rgb(0.80, 0.92, 0.95).setFill()
+ shifted(pen(liquid, n, closed: true, seed: 21, wobble: 0.008), n * 0.01, -n * 0.008).fill()
+ ink(pen(glass, n, closed: true, seed: 22), n)
+ // thick base line
+ let base = rotate([CGPoint(x: 0.61, y: 0.235), CGPoint(x: 0.71, y: 0.235)], by: 10, around: gc)
+ ink(pen(base, n, closed: false, seed: 23, wobble: 0.002), n, width: 0.016)
+ if !small {
+ let ge = rotate([CGPoint(x: 0.635, y: 0.30), CGPoint(x: 0.685, y: 0.30)], by: 10, around: gc)
+ dot(ge[0], 0.011, n); dot(ge[1], 0.011, n)
+ let gm = rotate([CGPoint(x: 0.65, y: 0.275), CGPoint(x: 0.66, y: 0.268), CGPoint(x: 0.67, y: 0.275)], by: 10, around: gc)
+ ink(pen(gm, n, closed: false, seed: 24, wobble: 0.001), n, width: 0.012)
+ // a splash where they touch
+ ink(pen([CGPoint(x: 0.555, y: 0.47), CGPoint(x: 0.575, y: 0.51)], n, closed: false, seed: 31, wobble: 0.002), n, width: 0.016)
+ ink(pen([CGPoint(x: 0.59, y: 0.465), CGPoint(x: 0.62, y: 0.49)], n, closed: false, seed: 32, wobble: 0.002), n, width: 0.016)
+ ink(pen([CGPoint(x: 0.605, y: 0.43), CGPoint(x: 0.64, y: 0.44)], n, closed: false, seed: 33, wobble: 0.002), n, width: 0.016)
+ sparkle(CGPoint(x: 0.70, y: 0.66), 0.045, n, seed: 41)
+ sparkle(CGPoint(x: 0.77, y: 0.55), 0.028, n, seed: 42)
+ sparkle(CGPoint(x: 0.22, y: 0.70), 0.03, n, seed: 43)
+ }
NSGraphicsContext.restoreGraphicsState()
}