知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
feat: redraw the logo (B), the cicada peeks over a white subtitle card
wqugurufebe5d47d1a9
diff --git a/Sources/LiveSubs/Onboarding.swift b/Sources/LiveSubs/Onboarding.swiftindex af04601..7d21ed7 100644--- a/Sources/LiveSubs/Onboarding.swift+++ b/Sources/LiveSubs/Onboarding.swift@@ -3,51 +3,109 @@ import AVFoundationimport AVKitimport SwiftUI-// MARK: - Brand mark (logo H1: a cicada's eyes and wings peeking over a subtitle bar)+// MARK: - Brand mark (logo B: a cicada's eyes and wings peeking over a white subtitle card)/// The logo in its 100-unit design space, y down (same geometry as site/icon.svg and-/// Sources/LiveSubsIcon; keep the three in step).+/// Sources/LiveSubsIcon; keep the three in step). Design: claude.ai/artifact/96R6Md276c3jAS4Mk4Ustnenum CicadaLogo {- static let orange = CGColor(srgbRed: 0.91, green: 0.333, blue: 0.169, alpha: 1) // #E8552B- static let ink = CGColor(srgbRed: 0.082, green: 0.09, blue: 0.11, alpha: 1) // #15171C+ static let orange = rgb(0xE8552B)+ static let ink = rgb(0x15171C)static let white = CGColor(gray: 1, alpha: 1)- static func wings(_ c: CGContext) {- c.move(to: CGPoint(x: 18, y: 36)); c.addQuadCurve(to: CGPoint(x: 45, y: 20), control: CGPoint(x: 26, y: 10))- c.move(to: CGPoint(x: 82, y: 36)); c.addQuadCurve(to: CGPoint(x: 55, y: 20), control: CGPoint(x: 74, y: 10))+ static func rgb(_ hex: UInt32, _ alpha: CGFloat = 1) -> CGColor {+ CGColor(srgbRed: CGFloat(hex >> 16 & 0xFF) / 255, green: CGFloat(hex >> 8 & 0xFF) / 255,+ blue: CGFloat(hex & 0xFF) / 255, alpha: alpha)+ }+ static func gradient(_ stops: [(UInt32, CGFloat)], at locations: [CGFloat]) -> CGGradient {+ CGGradient(colorsSpace: CGColorSpace(name: CGColorSpace.sRGB), colors: stops.map { rgb($0.0, $0.1) } as CFArray,+ locations: locations)!}static func circle(_ c: CGContext, _ x: CGFloat, _ y: CGFloat, _ r: CGFloat) {c.addEllipse(in: CGRect(x: x - r, y: y - r, width: 2 * r, height: 2 * r))}- static let bar = CGPath(roundedRect: CGRect(x: 12, y: 58, width: 76, height: 28), cornerWidth: 9, cornerHeight: 9, transform: nil)- static func line(_ c: CGContext, y: CGFloat, length: CGFloat) {- c.move(to: CGPoint(x: 21, y: y)); c.addLine(to: CGPoint(x: 21 + length, y: y))+ static func wings(_ c: CGContext) {+ c.move(to: CGPoint(x: 21, y: 42)); c.addQuadCurve(to: CGPoint(x: 44, y: 27), control: CGPoint(x: 26, y: 17))+ c.move(to: CGPoint(x: 78, y: 39)); c.addQuadCurve(to: CGPoint(x: 55, y: 25), control: CGPoint(x: 73, y: 14))+ }+ static let eyes: [(CGFloat, CGFloat)] = [(36, 51), (63, 49)]+ /// The card leans 5° and bleeds off the right and bottom edges, so the eyes peek over it.+ static func tilt(_ c: CGContext) {+ c.translateBy(x: 50, y: 70); c.rotate(by: -5 * .pi / 180); c.translateBy(x: -50, y: -70)}- /// Full colour, without the orange squircle (callers draw their own ground).- static func drawMark(_ c: CGContext) {+ /// The whole icon, clipped to its squircle. `unit` is device pixels per design unit+ /// (shadows are in device space).+ static func drawIcon(_ c: CGContext, unit: CGFloat) {+ c.saveGState()+ c.addPath(CGPath(roundedRect: CGRect(x: 0, y: 0, width: 100, height: 100), cornerWidth: 23, cornerHeight: 23, transform: nil))+ c.clip()+ c.drawLinearGradient(gradient([(0xF57447, 1), (0xDC461C, 1)], at: [0, 1]),+ start: .zero, end: CGPoint(x: 100, y: 100), options: [])+ c.drawLinearGradient(gradient([(0xFFFFFF, 0.2), (0xFFFFFF, 0)], at: [0, 1]),+ start: .zero, end: CGPoint(x: 0, y: 50), options: [])c.setLineCap(.round)- c.setStrokeColor(white); c.setLineWidth(6); wings(c); c.strokePath()- c.setFillColor(white); circle(c, 36, 46, 13); circle(c, 64, 46, 13); c.fillPath()- c.setFillColor(ink); circle(c, 39, 49, 6); circle(c, 67, 49, 6); c.fillPath()- c.addPath(bar); c.fillPath()- c.setLineWidth(5)- c.setStrokeColor(white); line(c, y: 68, length: 44); c.strokePath()- c.setStrokeColor(orange); line(c, y: 77, length: 26); c.strokePath()+ c.setStrokeColor(white); c.setLineWidth(5.5); wings(c); c.strokePath()++ let eyeShade = gradient([(0x3A3E48, 1), (0x0E0F12, 1)], at: [0, 1])+ for (x, y) in eyes {+ c.saveGState(); circle(c, x, y, 12.5); c.clip()+ let centre = CGPoint(x: x - 3.75, y: y - 6.25)+ c.drawRadialGradient(eyeShade, startCenter: centre, startRadius: 0, endCenter: centre, endRadius: 22.5,+ options: [.drawsAfterEndLocation])+ c.restoreGState()+ c.setStrokeColor(white); c.setLineWidth(5); circle(c, x, y, 12.5); c.strokePath()+ c.setFillColor(white); circle(c, x, y, 8.4); c.fillPath()+ c.setFillColor(ink); circle(c, x + 2, y + 2.2, 4.7); c.fillPath()+ c.setFillColor(white); circle(c, x + 3.5, y + 0.6, 1.5); c.fillPath()+ }++ c.saveGState()+ tilt(c)+ let card = CGPath(roundedRect: CGRect(x: 9, y: 60, width: 104, height: 56), cornerWidth: 12, cornerHeight: 12, transform: nil)+ c.saveGState()+ c.setShadow(offset: CGSize(width: 0, height: unit), blur: 4 * unit, color: rgb(0x7A1E05, 0.3))+ c.setFillColor(white); c.addPath(card); c.fillPath()+ c.restoreGState()+ c.saveGState(); c.addPath(card); c.clip()+ c.drawLinearGradient(gradient([(0xFFFFFF, 1), (0xF1EEEC, 1)], at: [0, 1]),+ start: CGPoint(x: 0, y: 60), end: CGPoint(x: 0, y: 116), options: [])+ c.restoreGState()+ c.saveGState(); c.addPath(card); c.setLineWidth(2); c.replacePathWithStrokedPath(); c.clip()+ c.drawLinearGradient(gradient([(0xFFC9B4, 1), (0xFFFFFF, 1), (0xFFE3A8, 1)], at: [0, 0.5, 1]),+ start: CGPoint(x: 9, y: 0), end: CGPoint(x: 113, y: 0), options: [])+ c.restoreGState()+ c.setLineWidth(5.4)+ c.setStrokeColor(ink); c.move(to: CGPoint(x: 22, y: 75)); c.addLine(to: CGPoint(x: 72, y: 75)); c.strokePath()+ c.setStrokeColor(orange); c.move(to: CGPoint(x: 22, y: 86)); c.addLine(to: CGPoint(x: 49, y: 86)); c.strokePath()+ c.restoreGState()+ c.restoreGState()}- /// One colour: wings, eyes and bar filled; pupils and text lines cut out.+ /// One colour for the menu bar: wings, eyes and a whole (not bleeding) card; whites of the eyes and text lines cut out.static func drawTemplate(_ c: CGContext, color: CGColor) {c.setLineCap(.round)- c.setStrokeColor(color); c.setLineWidth(7); wings(c); c.strokePath()- c.setFillColor(color); circle(c, 36, 46, 13); circle(c, 64, 46, 13); c.fillPath()- // In one colour the eyes would melt into the bar: cut a thin gap around it first.- c.setBlendMode(.clear); c.setLineWidth(9); c.addPath(bar); c.strokePath(); c.setBlendMode(.normal)- c.addPath(bar); c.fillPath()+ c.setStrokeColor(color); c.setLineWidth(6.5); wings(c); c.strokePath()+ c.setFillColor(color)+ for (x, y) in eyes { circle(c, x, y, 12.5) }+ c.fillPath()+ c.saveGState()+ tilt(c)+ let card = CGPath(roundedRect: CGRect(x: 10, y: 60, width: 80, height: 30), cornerWidth: 9, cornerHeight: 9, transform: nil)+ // In one colour the eyes would melt into the card: cut a thin gap around it first.+ c.setBlendMode(.clear); c.setLineWidth(9); c.addPath(card); c.strokePath(); c.setBlendMode(.normal)+ c.addPath(card); c.fillPath()+ c.setBlendMode(.clear); c.setLineWidth(6)+ c.move(to: CGPoint(x: 22, y: 70.5)); c.addLine(to: CGPoint(x: 72, y: 70.5))+ c.move(to: CGPoint(x: 22, y: 80.5)); c.addLine(to: CGPoint(x: 49, y: 80.5))+ c.strokePath()+ c.restoreGState()+ // Eyes as in colour: ring, cut-out white, pupil.c.setBlendMode(.clear)- circle(c, 39, 49, 6.5); circle(c, 67, 49, 6.5); c.fillPath()- c.setLineWidth(6); line(c, y: 68, length: 44); line(c, y: 77, length: 26); c.strokePath()+ for (x, y) in eyes { circle(c, x, y, 8.4) }+ c.fillPath()c.setBlendMode(.normal)+ for (x, y) in eyes { circle(c, x + 2, y + 2.2, 4.7) }+ c.fillPath()}}@@ -68,9 +126,7 @@ enum BrandImage {NSImage(size: NSSize(width: 100, height: 100), flipped: true) { rect inguard let c = NSGraphicsContext.current?.cgContext else { return false }c.scaleBy(x: rect.width / 100, y: rect.height / 100)- c.addPath(CGPath(roundedRect: CGRect(x: 0, y: 0, width: 100, height: 100), cornerWidth: 23, cornerHeight: 23, transform: nil))- c.setFillColor(CicadaLogo.orange); c.fillPath()- CicadaLogo.drawMark(c)+ CicadaLogo.drawIcon(c, unit: abs(c.ctm.a))return true}}()@@ -79,8 +135,8 @@ enum BrandImage {static func menuBar(live: Bool) -> NSImage {let img = NSImage(size: NSSize(width: 18, height: 16), flipped: true) { _ inguard let c = NSGraphicsContext.current?.cgContext else { return false }- // Design units 10…90 across and 8…88 down fill the 16 pt height.- c.translateBy(x: 1, y: 0); c.scaleBy(x: 0.2, y: 0.2); c.translateBy(x: -10, y: -8)+ // Design units 8…92 across and 16…94 down fill the 16 pt height.+ c.translateBy(x: 1, y: 0.4); c.scaleBy(x: 0.19, y: 0.19); c.translateBy(x: -8, y: -16)CicadaLogo.drawTemplate(c, color: CGColor(gray: 0, alpha: live ? 1 : 0.4))return true}diff --git a/Sources/LiveSubsIcon/main.swift b/Sources/LiveSubsIcon/main.swiftindex c3beb2b..74d4deb 100644--- a/Sources/LiveSubsIcon/main.swift+++ b/Sources/LiveSubsIcon/main.swift@@ -1,10 +1,87 @@-// Renders the app icon (logo H1: a cicada's eyes and wings peeking over a subtitle bar, on orange)+// Renders the app icon (logo B: a cicada's eyes and wings peeking over a white subtitle card, on orange)// into an .iconset. `LiveSubsIcon [--dev] <out.iconset>`; --dev adds a "DEV" band.import AppKitlet orange = NSColor(srgbRed: 0.91, green: 0.33, blue: 0.17, alpha: 1) // #E8552Blet ink = NSColor(srgbRed: 0.082, green: 0.09, blue: 0.11, alpha: 1) // #15171C+// A copy of CicadaLogo in Sources/LiveSubs/Onboarding.swift (this target can't import the app);+// keep it, that file and site/icon.svg in step.+enum CicadaLogo {+ static let orange = rgb(0xE8552B)+ static let ink = rgb(0x15171C)+ static let white = CGColor(gray: 1, alpha: 1)++ static func rgb(_ hex: UInt32, _ alpha: CGFloat = 1) -> CGColor {+ CGColor(srgbRed: CGFloat(hex >> 16 & 0xFF) / 255, green: CGFloat(hex >> 8 & 0xFF) / 255,+ blue: CGFloat(hex & 0xFF) / 255, alpha: alpha)+ }+ static func gradient(_ stops: [(UInt32, CGFloat)], at locations: [CGFloat]) -> CGGradient {+ CGGradient(colorsSpace: CGColorSpace(name: CGColorSpace.sRGB), colors: stops.map { rgb($0.0, $0.1) } as CFArray,+ locations: locations)!+ }+ static func circle(_ c: CGContext, _ x: CGFloat, _ y: CGFloat, _ r: CGFloat) {+ c.addEllipse(in: CGRect(x: x - r, y: y - r, width: 2 * r, height: 2 * r))+ }+ static func wings(_ c: CGContext) {+ c.move(to: CGPoint(x: 21, y: 42)); c.addQuadCurve(to: CGPoint(x: 44, y: 27), control: CGPoint(x: 26, y: 17))+ c.move(to: CGPoint(x: 78, y: 39)); c.addQuadCurve(to: CGPoint(x: 55, y: 25), control: CGPoint(x: 73, y: 14))+ }+ static let eyes: [(CGFloat, CGFloat)] = [(36, 51), (63, 49)]+ /// The card leans 5° and bleeds off the right and bottom edges, so the eyes peek over it.+ static func tilt(_ c: CGContext) {+ c.translateBy(x: 50, y: 70); c.rotate(by: -5 * .pi / 180); c.translateBy(x: -50, y: -70)+ }++ /// The whole icon, clipped to its squircle. `unit` is device pixels per design unit+ /// (shadows are in device space).+ static func drawIcon(_ c: CGContext, unit: CGFloat) {+ c.saveGState()+ c.addPath(CGPath(roundedRect: CGRect(x: 0, y: 0, width: 100, height: 100), cornerWidth: 23, cornerHeight: 23, transform: nil))+ c.clip()+ c.drawLinearGradient(gradient([(0xF57447, 1), (0xDC461C, 1)], at: [0, 1]),+ start: .zero, end: CGPoint(x: 100, y: 100), options: [])+ c.drawLinearGradient(gradient([(0xFFFFFF, 0.2), (0xFFFFFF, 0)], at: [0, 1]),+ start: .zero, end: CGPoint(x: 0, y: 50), options: [])+ c.setLineCap(.round)+ c.setStrokeColor(white); c.setLineWidth(5.5); wings(c); c.strokePath()++ let eyeShade = gradient([(0x3A3E48, 1), (0x0E0F12, 1)], at: [0, 1])+ for (x, y) in eyes {+ c.saveGState(); circle(c, x, y, 12.5); c.clip()+ let centre = CGPoint(x: x - 3.75, y: y - 6.25)+ c.drawRadialGradient(eyeShade, startCenter: centre, startRadius: 0, endCenter: centre, endRadius: 22.5,+ options: [.drawsAfterEndLocation])+ c.restoreGState()+ c.setStrokeColor(white); c.setLineWidth(5); circle(c, x, y, 12.5); c.strokePath()+ c.setFillColor(white); circle(c, x, y, 8.4); c.fillPath()+ c.setFillColor(ink); circle(c, x + 2, y + 2.2, 4.7); c.fillPath()+ c.setFillColor(white); circle(c, x + 3.5, y + 0.6, 1.5); c.fillPath()+ }++ c.saveGState()+ tilt(c)+ let card = CGPath(roundedRect: CGRect(x: 9, y: 60, width: 104, height: 56), cornerWidth: 12, cornerHeight: 12, transform: nil)+ c.saveGState()+ c.setShadow(offset: CGSize(width: 0, height: unit), blur: 4 * unit, color: rgb(0x7A1E05, 0.3))+ c.setFillColor(white); c.addPath(card); c.fillPath()+ c.restoreGState()+ c.saveGState(); c.addPath(card); c.clip()+ c.drawLinearGradient(gradient([(0xFFFFFF, 1), (0xF1EEEC, 1)], at: [0, 1]),+ start: CGPoint(x: 0, y: 60), end: CGPoint(x: 0, y: 116), options: [])+ c.restoreGState()+ c.saveGState(); c.addPath(card); c.setLineWidth(2); c.replacePathWithStrokedPath(); c.clip()+ c.drawLinearGradient(gradient([(0xFFC9B4, 1), (0xFFFFFF, 1), (0xFFE3A8, 1)], at: [0, 0.5, 1]),+ start: CGPoint(x: 9, y: 0), end: CGPoint(x: 113, y: 0), options: [])+ c.restoreGState()+ c.setLineWidth(5.4)+ c.setStrokeColor(ink); c.move(to: CGPoint(x: 22, y: 75)); c.addLine(to: CGPoint(x: 72, y: 75)); c.strokePath()+ c.setStrokeColor(orange); c.move(to: CGPoint(x: 22, y: 86)); c.addLine(to: CGPoint(x: 49, y: 86)); c.strokePath()+ c.restoreGState()+ c.restoreGState()+ }+}+func render(_ px: Int, dev: Bool) -> Data {let rep = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: px, pixelsHigh: px, bitsPerSample: 8,samplesPerPixel: 4, hasAlpha: true, isPlanar: false, colorSpaceName: .deviceRGB,@@ -24,25 +101,12 @@ func render(_ px: Int, dev: Bool) -> Data {squircle.fill()NSShadow().set()- // Design space is the 100-unit logo, y down, mapped onto the body (same geometry as- // CicadaLogo in Sources/LiveSubs/Onboarding.swift and site/icon.svg; keep them in step).+ // Design space is the 100-unit logo, y down, mapped onto the body.let c = NSGraphicsContext.current!.cgContextc.saveGState()c.translateBy(x: body.minX, y: body.maxY)c.scaleBy(x: body.width / 100, y: -body.height / 100)- c.setLineCap(.round)- c.setStrokeColor(NSColor.white.cgColor)- c.setLineWidth(6)- c.move(to: CGPoint(x: 18, y: 36)); c.addQuadCurve(to: CGPoint(x: 45, y: 20), control: CGPoint(x: 26, y: 10))- c.move(to: CGPoint(x: 82, y: 36)); c.addQuadCurve(to: CGPoint(x: 55, y: 20), control: CGPoint(x: 74, y: 10))- c.strokePath()- func circle(_ x: CGFloat, _ y: CGFloat, _ r: CGFloat) { c.addEllipse(in: CGRect(x: x - r, y: y - r, width: 2 * r, height: 2 * r)) }- c.setFillColor(NSColor.white.cgColor); circle(36, 46, 13); circle(64, 46, 13); c.fillPath()- c.setFillColor(ink.cgColor); circle(39, 49, 6); circle(67, 49, 6); c.fillPath()- c.addPath(CGPath(roundedRect: CGRect(x: 12, y: 58, width: 76, height: 28), cornerWidth: 9, cornerHeight: 9, transform: nil)); c.fillPath()- c.setLineWidth(5)- c.setStrokeColor(NSColor.white.cgColor); c.move(to: CGPoint(x: 21, y: 68)); c.addLine(to: CGPoint(x: 65, y: 68)); c.strokePath()- c.setStrokeColor(orange.cgColor); c.move(to: CGPoint(x: 21, y: 77)); c.addLine(to: CGPoint(x: 47, y: 77)); c.strokePath()+ CicadaLogo.drawIcon(c, unit: body.width / 100)c.restoreGState()if dev {diff --git a/docs/icon.png b/docs/icon.pngindex 712c0e2..0a50a58 100644Binary files a/docs/icon.png and b/docs/icon.png differdiff --git a/site/icon.png b/site/icon.pngindex 499ac39..0a35879 100644Binary files a/site/icon.png and b/site/icon.png differdiff --git a/site/icon.svg b/site/icon.svgindex fa97a81..0707074 100644--- a/site/icon.svg+++ b/site/icon.svg@@ -1 +1 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="512" height="512"><rect width="100" height="100" rx="23" fill="#E8552B"/><g fill="none" stroke="#FFFFFF" stroke-width="6" stroke-linecap="round"><path d="M18 36Q26 10 45 20"/><path d="M82 36Q74 10 55 20"/></g><circle cx="36" cy="46" r="13" fill="#FFFFFF"/><circle cx="64" cy="46" r="13" fill="#FFFFFF"/><circle cx="39" cy="49" r="6" fill="#15171C"/><circle cx="67" cy="49" r="6" fill="#15171C"/><rect x="12" y="58" width="76" height="28" rx="9" fill="#15171C"/><g stroke-linecap="round" stroke-width="5"><path d="M21 68h44" stroke="#FFFFFF"/><path d="M21 77h26" stroke="#E8552B"/></g></svg>+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="512" height="512"><defs><clipPath id="sq"><rect width="100" height="100" rx="23"/></clipPath><linearGradient id="bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#F57447"/><stop offset="1" stop-color="#DC461C"/></linearGradient><linearGradient id="sheen" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fff" stop-opacity=".2"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient><radialGradient id="eye" cx=".35" cy=".25" r=".9"><stop offset="0" stop-color="#3A3E48"/><stop offset="1" stop-color="#0E0F12"/></radialGradient><linearGradient id="card" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fff"/><stop offset="1" stop-color="#F1EEEC"/></linearGradient><linearGradient id="rim" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#FFC9B4"/><stop offset=".5" stop-color="#fff"/><stop offset="1" stop-color="#FFE3A8"/></linearGradient><filter id="sh" x="-20%" y="-30%" width="140%" height="160%"><feDropShadow dy="-1" stdDeviation="2" flood-color="#7A1E05" flood-opacity=".3"/></filter></defs><g clip-path="url(#sq)"><rect width="100" height="100" fill="url(#bg)"/><rect width="100" height="50" fill="url(#sheen)"/><g fill="none" stroke="#fff" stroke-width="5.5" stroke-linecap="round"><path d="M21 42Q26 17 44 27"/><path d="M78 39Q73 14 55 25"/></g><g stroke="#fff" stroke-width="5" fill="url(#eye)"><circle cx="36" cy="51" r="12.5"/><circle cx="63" cy="49" r="12.5"/></g><g fill="#fff"><circle cx="36" cy="51" r="8.4"/><circle cx="63" cy="49" r="8.4"/></g><g fill="#15171C"><circle cx="38" cy="53.2" r="4.7"/><circle cx="65" cy="51.2" r="4.7"/></g><g fill="#fff"><circle cx="39.5" cy="51.6" r="1.5"/><circle cx="66.5" cy="49.6" r="1.5"/></g><g transform="rotate(-5 50 70)"><rect x="9" y="60" width="104" height="56" rx="12" fill="url(#card)" stroke="url(#rim)" stroke-width="2" filter="url(#sh)"/><g stroke-linecap="round" stroke-width="5.4"><path d="M22 75H72" stroke="#15171C"/><path d="M22 86H49" stroke="#E8552B"/></g></g></g></svg>diff --git a/site/og.png b/site/og.pngindex 07f84db..19a192a 100644Binary files a/site/og.png and b/site/og.png differ