From c7c53a85b129ac2dc01cb89da06007d69a422cc0 Mon Sep 17 00:00:00 2001 From: James Yuzawa Date: Wed, 28 Dec 2022 20:06:30 -0500 Subject: [PATCH 1/2] better colors and sizes --- Polyhedra/Polyhedra.swift | 2 +- Polyhedra/PolyhedraFullLayer.swift | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Polyhedra/Polyhedra.swift b/Polyhedra/Polyhedra.swift index fa5ca3c..98bb412 100644 --- a/Polyhedra/Polyhedra.swift +++ b/Polyhedra/Polyhedra.swift @@ -69,7 +69,7 @@ struct Polyhedron: Codable { backLayer.contentsScale = Polyhedron.scale backLayer.lineWidth = lineWidth backLayer.isOpaque = true - backLayer.strokeColor = color.copy(alpha: 0.25)! + backLayer.strokeColor = color.copy(alpha: 0.4)! backLayer.path = backPath.copy() let frontLayer = CAShapeLayer() frontLayer.contentsScale = Polyhedron.scale diff --git a/Polyhedra/PolyhedraFullLayer.swift b/Polyhedra/PolyhedraFullLayer.swift index e88f965..1bf9382 100644 --- a/Polyhedra/PolyhedraFullLayer.swift +++ b/Polyhedra/PolyhedraFullLayer.swift @@ -24,7 +24,7 @@ class PolyhedraFullLayer: CALayer { self.polyhedraLayer = CALayer() self.polyhedraLayer.isOpaque = true self.framesPerDegree = fps * PolyhedraFullLayer.rotationSeconds / PolyhedraFullLayer.degrees - self.radius = Int(min(size.width, size.height) * 0.15) + self.radius = Int(min(size.width, size.height) * 0.125) self.velocityX = max(1, radius / fps * 2) self.velocityY = velocityX // make sure polyhedron (2 * radius in width) does not got off screen @@ -43,8 +43,8 @@ class PolyhedraFullLayer: CALayer { addSublayer(polyhedraLayer) if !isPreview && settings.shouldShowPolyhedronName() { // configure text - let font = NSFont.menuBarFont(ofSize: -1) - let fontSize = font.pointSize + let fontSize = NSFont.systemFontSize * 2 + let font = NSFont.systemFont(ofSize: fontSize) let textLayer = CATextLayer() textLayer.contentsScale = Polyhedron.scale let name = polyhedron.name @@ -56,7 +56,7 @@ class PolyhedraFullLayer: CALayer { textLayer.alignmentMode = .left textLayer.string = polyhedron.name textLayer.backgroundColor = CGColor.clear - textLayer.foregroundColor = CGColor.init(gray: 1.0, alpha: 0.2) + textLayer.foregroundColor = CGColor.init(gray: 1.0, alpha: 0.3) textLayer.rasterizationScale = Polyhedron.scale textLayer.shouldRasterize = true textLayer.isOpaque = true From 8f3f560475e44a147579b8fd3d06d5f8b91a0e58 Mon Sep 17 00:00:00 2001 From: James Yuzawa Date: Wed, 28 Dec 2022 21:10:18 -0500 Subject: [PATCH 2/2] use ints --- Polyhedra/PolyhedraFullLayer.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Polyhedra/PolyhedraFullLayer.swift b/Polyhedra/PolyhedraFullLayer.swift index 1bf9382..4388265 100644 --- a/Polyhedra/PolyhedraFullLayer.swift +++ b/Polyhedra/PolyhedraFullLayer.swift @@ -49,8 +49,9 @@ class PolyhedraFullLayer: CALayer { textLayer.contentsScale = Polyhedron.scale let name = polyhedron.name let stringSize = name.size(withAttributes: [.font: font]) - let textOffset = CGFloat(radius) * 0.1 - textLayer.frame = CGRect(origin: CGPoint(x: textOffset, y: textOffset), size: stringSize) + let textOffset = Int(CGFloat(radius) * 0.1) + textLayer.frame = CGRect(origin: CGPoint(x: textOffset, y: textOffset), + size: CGSize(width: Int(stringSize.width), height: Int(stringSize.height))) textLayer.font = font textLayer.fontSize = fontSize textLayer.alignmentMode = .left