File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Sources/MaterialColorUtilities/DynamicColor
Tests/MaterialColorUtilitiesTests/SchemeTests Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -366,7 +366,7 @@ class DynamicColor {
366
366
/// - Parameter tone: The tone to be judged.
367
367
/// - Returns: whether `tone` prefers a light foreground.
368
368
static func tonePrefersLightForeground( _ tone: Double ) -> Bool {
369
- return round ( tone) <= 60
369
+ return round ( tone) < 60
370
370
}
371
371
372
372
/// Returns whether `tone` can reach a contrast ratio of 4.5 with a lighter
Original file line number Diff line number Diff line change @@ -379,4 +379,17 @@ final class SchemeFidelityTests: XCTestCase {
379
379
XCTAssertEqual ( MaterialDynamicColors . onTertiaryFixed. getArgb ( scheme) , 0xff00_0000 )
380
380
XCTAssertEqual ( MaterialDynamicColors . onTertiaryFixedVariant. getArgb ( scheme) , 0xff37_0000 )
381
381
}
382
+
383
+ func testEdgeCaseWithTone60( ) {
384
+ let scheme = SchemeFidelity (
385
+ sourceColorHct: Hct . fromInt ( 0xffff_0000 ) ,
386
+ isDark: false ,
387
+ contrastLevel: 0
388
+ )
389
+
390
+ XCTAssertEqual ( MaterialDynamicColors . secondary. getArgb ( scheme) , 0xffb7_2114 )
391
+ XCTAssertEqual ( MaterialDynamicColors . onSecondary. getArgb ( scheme) , 0xffff_ffff )
392
+ XCTAssertEqual ( MaterialDynamicColors . secondaryContainer. getArgb ( scheme) , 0xffff_6f5b )
393
+ XCTAssertEqual ( MaterialDynamicColors . onSecondaryContainer. getArgb ( scheme) , 0xff27_0000 )
394
+ }
382
395
}
You can’t perform that action at this time.
0 commit comments