-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of #51.
- Loading branch information
Showing
5 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Sources/Slipstream/TailwindCSS/Filters/View+colorInvert.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extension View { | ||
/// Inverts all of the colors in a view so that each color displays as its complementary color. | ||
/// | ||
/// For example, blue converts to yellow, and white converts to black. | ||
/// | ||
/// - SeeAlso: Tailwind CSS' [invert](https://tailwindcss.com/docs/invert) documentation. | ||
@available(iOS 17.0, macOS 14.0, *) | ||
public func colorInvert(condition: Condition? = nil) -> some View { | ||
return modifier(TailwindClassModifier(add: "invert", condition: condition)) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Tests/SlipstreamTests/TailwindCSS/Filters/ColorInvertTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Testing | ||
import Slipstream | ||
|
||
struct ColorInvertTests { | ||
@Test func applies() throws { | ||
try #expect(renderHTML(Div {}.colorInvert()) == #"<div class="invert"></div>"#) | ||
} | ||
} |