Skip to content

Commit

Permalink
Add logo to document (#64)
Browse files Browse the repository at this point in the history
* add logo generation

* ignore automatically generated logo images

* add dependency to Images.jl

* Fix path to output png files

Co-authored-by: Johnny Chen <[email protected]>

* Fix path to input png file

Co-authored-by: Johnny Chen <[email protected]>

Co-authored-by: Johnny Chen <[email protected]>
  • Loading branch information
hyrodium and johnnychen94 authored May 30, 2021
1 parent 8ad55d9 commit 54f3cfe
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
*.jl.mem
Manifest.toml
/docs/build

# automatically generated logo
/docs/src/assets/logo.png
/docs/src/assets/logo-dark.png
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
ImageDraw = "4381153b-2b60-58ae-a1ba-fd683676385f"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"
47 changes: 47 additions & 0 deletions docs/logo.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
function generate_logo()
# Load original image (from https://github.com/JuliaImages/juliaimages.github.io/blob/source/docs/src/assets/logo.png)
img = load(joinpath(@__DIR__, "logo_original.png"))

# Define some colors
c_red, c_green, c_blue, c_purple = RGBA.([Colors.JULIA_LOGO_COLORS...])
gray_dark = RGBA{N0f8}(0.1,0.1,0.1)
gray_light = RGBA{N0f8}(0.9,0.9,0.9)

# Change base color black to gray
img = img*N0f8(0.5) .+ RGBA{N0f8}(0.5,0.5,0.5,0)
img_dark = copy(img)
img_light = copy(img)

# Define points on the image
p_green = Point(87,35)
p_red = Point(75,55)
p_purple = Point(99,55)
p_1 = Point(13,96)
p_2 = Point(52,50)
p_3 = Point(73,73)
p_4 = Point(84,62)
p_5 = Point(116,97)

# Define path
path_dark = joinpath(@__DIR__, "src", "assets", "logo-dark.png")
path_light = joinpath(@__DIR__, "src", "assets", "logo.png")

for (img,gray,name) in ((img_dark,gray_light,path_dark), (img_light,gray_dark,path_light))
draw!(img, LineTwoPoints(p_1,p_2), gray)
draw!(img, LineTwoPoints(p_2,p_3), gray)
draw!(img, LineTwoPoints(p_3,p_4), gray)
draw!(img, LineTwoPoints(p_4,p_5), gray)

draw!(img, Cross(p_1,8), gray)
draw!(img, Cross(p_2,8), gray)
draw!(img, Cross(p_3,8), gray)
draw!(img, Cross(p_4,8), gray)
draw!(img, Cross(p_5,8), gray)

draw!(img, Ellipse(CirclePointRadius(p_green,10)), c_green)
draw!(img, Ellipse(CirclePointRadius(p_red,10)), c_red)
draw!(img, Ellipse(CirclePointRadius(p_purple,10)), c_purple)

save(name,img)
end
end
Binary file added docs/logo_original.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Documenter, ImageDraw
using Documenter, Images, ImageDraw

include("logo.jl")
generate_logo()

makedocs(sitename="ImageDraw.jl",
format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"))
Expand Down

0 comments on commit 54f3cfe

Please sign in to comment.