This commit is contained in:
2025-07-17 09:30:42 -04:00
parent f63bb0ba41
commit 4f01a6445f
7 changed files with 248 additions and 14 deletions

View File

@ -13,12 +13,14 @@ enum CheckboxStatus {
case checked
case unchecked
case intermediate
case cancelled
var color: Color {
switch (self) {
case .checked: .green
case .unchecked: .gray
case .intermediate: .yellow
case .cancelled: .red
}
}
@ -27,6 +29,7 @@ enum CheckboxStatus {
case .checked: "checkmark.circle.fill"
case .unchecked: "circle"
case .intermediate: "ellipsis.circle"
case .cancelled: "cross.circle"
}
}
}

View File

@ -0,0 +1,30 @@
//
// Color+darker.swift
// Workouts
//
// Created by rzen on 7/17/25 at 9:20AM.
//
// Copyright 2025 Rouslan Zenetl. All Rights Reserved.
//
import SwiftUI
import UIKit
extension Color {
func darker(by percentage: CGFloat) -> Color {
let uiColor = UIColor(self)
var hue: CGFloat = 0
var saturation: CGFloat = 0
var brightness: CGFloat = 0
var alpha: CGFloat = 0
if uiColor.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha) {
let newBrightness = max(brightness * (1 - percentage), 0)
let darkerUIColor = UIColor(hue: hue, saturation: saturation, brightness: newBrightness, alpha: alpha)
return Color(darkerUIColor)
}
return self // Fallback if color can't be converted
}
}