Skip to content

Commit

Permalink
Update Double+Extensions.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelesantos committed Apr 11, 2024
1 parent 3ea1beb commit e609a2e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/RefdsShared/Extension/Double+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import SwiftUI

public extension Double {
func rounded(toPlaces places: Int) -> Double {
Expand Down Expand Up @@ -33,4 +34,10 @@ public extension Double {
func percent(format: String = "%2.f") -> String {
String(format: format, self * 100) + "%"
}

var riskColor: Color {
self < 0.6 ? .green :
self < 0.9 ? .yellow :
self < 1 ? .orange : .red
}
}

0 comments on commit e609a2e

Please sign in to comment.