Skip to content

Commit

Permalink
fix hex color format prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisNikkel committed Sep 16, 2023
1 parent 383dd89 commit be80af6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions SharpVG/Color.fs
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ with
override this.ToString() =
match this with
| Name n -> n.ToString().ToLower()
| SmallHex sh -> String.Format("0x{0:x}", sh)
| Hex h -> String.Format("0x{0:x}", h)
| SmallHex sh -> String.Format("#{0:x}", sh)
| Hex h -> String.Format("#{0:x}", h)
| Values (r, g, b) -> "rgb(" + string r + "," + string g + "," + string b + ")"
| Percents (r, g, b) -> "rgb(" + string r + "%," + string g + "%," + string b + "%)"

Expand Down
4 changes: 2 additions & 2 deletions Tests/TestColor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ module TestColor =

[<Fact>]
let ``create with small hex`` () =
Assert.Equal("0x123", Color.ofSmallHex 0x123s |> Color.toString)
Assert.Equal("#123", Color.ofSmallHex 0x123s |> Color.toString)

[<Fact>]
let ``create with hex`` () =
Assert.Equal("0x112233", Color.ofHex 0x112233 |> Color.toString)
Assert.Equal("#112233", Color.ofHex 0x112233 |> Color.toString)

[<Fact>]
let ``create with percents`` () =
Expand Down

0 comments on commit be80af6

Please sign in to comment.