Skip to content

Commit

Permalink
Update ColorExtension.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzukihashi committed Oct 3, 2024
1 parent 40c9060 commit bfeb785
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/TsuzuKit/Extension/ColorExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public extension Color {
self = Color(hue: h, saturation: s, brightness: b, opacity: opacity)
}

init(hex: String, opacity: Double = 1.0) {
let v = Int(hex, radix: 16) ?? 0
init(code: String, opacity: Double = 1.0) {
let v = Int(code, radix: 16) ?? 0
let r = Double(v / Int(powf(256, 2)) % 256) / 255
let g = Double(v / Int(powf(256, 1)) % 256) / 255
let b = Double(v / Int(powf(256, 0)) % 256) / 255
Expand Down

0 comments on commit bfeb785

Please sign in to comment.