1
1
mirror of https://github.com/aelve/guide.git synced 2024-12-23 04:42:24 +03:00

Add a favicon

This commit is contained in:
Artyom 2016-05-10 23:44:20 +03:00
parent fdaba16282
commit 095cb507b7
4 changed files with 45 additions and 0 deletions

21
favicon/gen.hs Normal file
View File

@ -0,0 +1,21 @@
{-# LANGUAGE
FlexibleContexts,
GADTs
#-}
-- run as: ./gen -o favicon.png -w 32 -h 32
import Diagrams.Prelude
import Diagrams.Backend.Rasterific.CmdLine
main = defaultMain icon
icon :: Diagram B
icon = lines_ `atop` canvas_
where
line_ = rect 14 3 # fc white . lw none
dot_ = circle 2 # fc white . lw none
line1 = alignL $ hsep 2 [line_, dot_]
line2 = alignL $ hsep 2 [dot_, line_]
lines_ = centerXY $ vsep 3 [line1, line2, line1]
canvas_ = roundedRect 32 32 4 # fc (sRGB24read "7868FF") . lw none

23
favicon/gen.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# see https://github.com/audreyr/favicon-cheat-sheet
# TODO: make larger icons for Android/iOS
ghc gen.hs
rm -f favicon.ico
for n in 16 24 32 48 64
do
echo "generating $n x $n"
./gen -o "favicon-$n.png" -w "$n" -h "$n"
optipng -quiet -o7 "favicon-$n.png"
done
convert favicon-*.png favicon.ico
rm -f favicon-*.png gen gen.o gen.hi
echo ""
echo "now move favicon.ico to static/"

View File

@ -532,6 +532,7 @@ wrapPage pageTitle page = doctypehtml_ $ do
title_ (toHtml pageTitle) title_ (toHtml pageTitle)
meta_ [name_ "viewport", meta_ [name_ "viewport",
content_ "width=device-width, initial-scale=1.0, user-scalable=yes"] content_ "width=device-width, initial-scale=1.0, user-scalable=yes"]
link_ [rel_ "shortcut icon", href_ "/favicon.ico"]
token <- _googleToken <$> lift ask token <- _googleToken <$> lift ask
unless (T.null token) $ unless (T.null token) $
meta_ [name_ "google-site-verification", content_ token] meta_ [name_ "google-site-verification", content_ token]

BIN
static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB