diff --git a/Sources/Kapture/ResultWindow.swift b/Sources/Kapture/ResultWindow.swift index cda74bd..bf2ab01 100644 --- a/Sources/Kapture/ResultWindow.swift +++ b/Sources/Kapture/ResultWindow.swift @@ -94,6 +94,8 @@ final class CaptureModel: ObservableObject { @Published var strokes: [[CGPoint]] = [] /// Whether the pen is active (drag draws instead of selecting) @Published var isDrawing = false + /// Current drawing color + @Published var drawColor: NSColor = .systemRed enum CaptureMode { case screenshot @@ -120,7 +122,7 @@ final class CaptureModel: ObservableObject { let ctx = NSGraphicsContext.current!.cgContext // CGImage draws with a flipped Y in NSGraphicsContext ctx.draw(image, in: NSRect(origin: .zero, size: size)) - NSColor.systemRed.setStroke() + drawColor.setStroke() ctx.setLineWidth(3) ctx.setLineCap(.round) ctx.setLineJoin(.round) @@ -285,6 +287,16 @@ struct ResultView: View { .foregroundStyle(model.isDrawing ? .primary : .secondary) .help("Toggle drawing on the screenshot") + if model.isDrawing { + ColorPicker("", selection: Binding( + get: { Color(nsColor: model.drawColor) }, + set: { model.drawColor = NSColor($0) } + ), supportsOpacity: false) + .labelsHidden() + .frame(width: 28) + .help("Drawing color") + } + if !model.strokes.isEmpty { Button { model.clearAnnotations() @@ -429,7 +441,7 @@ struct ScreenshotPane: View { path.addLine(to: CGPoint(x: origin.x + point.x * scale, y: origin.y + point.y * scale)) } } - context.stroke(path, with: .color(.red), lineWidth: 2.5) + context.stroke(path, with: .color(Color(nsColor: model.drawColor)), lineWidth: 2.5) } .allowsHitTesting(false) @@ -443,7 +455,7 @@ struct ScreenshotPane: View { path.addLine(to: CGPoint(x: origin.x + point.x * scale, y: origin.y + point.y * scale)) } } - context.stroke(path, with: .color(.red), lineWidth: 2.5) + context.stroke(path, with: .color(Color(nsColor: model.drawColor)), lineWidth: 2.5) } .allowsHitTesting(false) } diff --git a/build-app.sh b/build-app.sh index c6d8db9..dc7aa22 100755 --- a/build-app.sh +++ b/build-app.sh @@ -108,9 +108,9 @@ cat > "$APP/Contents/Info.plist" <<'PLIST' CFBundleIconFile Icon CFBundleShortVersionString - 1.3.2 + 1.3.3 CFBundleVersion - 32 + 33 LSUIElement NSHighResolutionCapable