Skip to content

Commit

Permalink
Remove pirated fucntions and replace by provided ones
Browse files Browse the repository at this point in the history
  • Loading branch information
jpthiele committed Nov 20, 2024
1 parent d387274 commit 1f83f69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 56 deletions.
12 changes: 0 additions & 12 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ rgbtuple(:red)
(1.0,1.0,1.0)
```

```@docs
ColorTypes.RGB
```

```@example
using ColorTypes,GridVisualizeTools # hide
RGB(:red)
```
```@example
using ColorTypes,GridVisualizeTools # hide
RGB("green")
```

## Visibility handling of grid cells

Expand Down
52 changes: 8 additions & 44 deletions src/colors.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""depend
$(SIGNATURES)
Create customized distinguishable colormap for interior regions.
Expand All @@ -16,7 +16,9 @@ RGB{Float64}(0.85, 0.6, 0.6)
"""
function region_cmap(n)
ColorSchemes.distinguishable_colors(max(5, n),
[Colors.RGB(0.85, 0.6, 0.6), Colors.RGB(0.6, 0.85, 0.6), Colors.RGB(0.6, 0.6, 0.85)];
[Colors.RGB{Float64}(0.85, 0.6, 0.6),
Colors.RGB{Float64}(0.6, 0.85, 0.6),
Colors.RGB{Float64}(0.6, 0.6, 0.85)];
lchoices = range(70; stop = 80, length = 5),
cchoices = range(25; stop = 65, length = 15),
hchoices = range(20; stop = 360, length = 15))
Expand All @@ -39,53 +41,15 @@ RGB{Float64}(1.0, 0.0, 0.0)
"""
function bregion_cmap(n)
ColorSchemes.distinguishable_colors(max(5, n),
[Colors.RGB(1.0, 0.0, 0.0), Colors.RGB(0.0, 1.0, 0.0), Colors.RGB(0.0, 0.0, 1.0)];
[Colors.RGB{Float64}(1.0, 0.0, 0.0),
Colors.RGB{Float64}(0.0, 1.0, 0.0),
Colors.RGB{Float64}(0.0, 0.0, 1.0)];
lchoices = range(50; stop = 75, length = 10),
cchoices = range(75; stop = 100, length = 10),
hchoices = range(20; stop = 360, length = 30))
end

"""
$(SIGNATURES)
Create RGB color from color name string.
julia> Colors.RGB("red")
RGB{Float64}(1.0,0.0,0.0)
```
"""
function Colors.RGB(c::String)
c64 = Colors.color_names[c]
Colors.RGB(c64[1] / 255, c64[2] / 255, c64[3] / 255)
end

"""
$(SIGNATURES)
Create RGB color from color name symbol.
```jldoctest
julia> Colors.RGB(:red)
RGB{Float64}(1.0, 0.0, 0.0)
```
"""
Colors.RGB(c::Symbol) = Colors.RGB(String(c))

"""
$(SIGNATURES)
Create RGB color from tuple
```jldoctest
julia> Colors.RGB((1.0,0,0))
RGB{Float64}(1.0, 0.0, 0.0)
```
"""
Colors.RGB(c::Tuple) = Colors.RGB(c...)

"""
$(SIGNATURES)
Create color tuple from color description (e.g. string)
```jldoctest
Expand All @@ -96,7 +60,7 @@ julia> rgbtuple("red")
(1.0, 0.0, 0.0)
```
"""
rgbtuple(c) = rgbtuple(Colors.RGB(c))
rgbtuple(c) = rgbtuple(parse(Colors.RGB{Float64},c))

"""
$(SIGNATURES)
Expand Down

0 comments on commit 1f83f69

Please sign in to comment.