issues installing colorific on alpine docker image see this post for dependencies https://stackoverflow.com/a/44044479
Last active
September 12, 2017 17:18
-
-
Save davidejones/944c6ee98ba295056440b4ce46eeba3c to your computer and use it in GitHub Desktop.
color pick background image from hugo built html file
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
#!/usr/bin/env bash | |
# color pick the homepage | |
image_filename="public/$(sed -n 's/.*data-color="\([^"]*\).*/\1/p' public/index.html)" | |
echo "Picking color from : ${image_filename}" | |
if type "colorific" > /dev/null && [ -f $image_filename ]; then | |
picked_color=$(echo $image_filename | colorific | cut -d# -f7) | |
echo "Picked color : ${picked_color}" | |
sed -i "/^[[:space:]]*.home-blog-bg/,/}$/ s/background-color:.*/background-color: #$picked_color;}/g" public/index.html | |
else | |
echo "image or library not found" | |
fi |
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 is public/index.html --> | |
<style type="text/css"> | |
.home-blog, | |
.home-blog-bg { | |
background-color: #FFFFFF; | |
} | |
</style> | |
<div class="row"> | |
<div class="col-md-7" data-color="img/blog/some-blog-post/some-blog-post-hero.jpg"></div> | |
<div class="col-xs-12 col-md-2"> | |
<div class="home-blog-bg"> | |
<p>Blah blah here is the content from the post</p> | |
</div> | |
</div> | |
</div> |
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
Picking color from : public/img/blog/some-blog-post/some-blog-post-hero.jpg | |
Picked color : 7292fe | |
... | |
<style type="text/css"> | |
.home-blog, | |
.home-blog-bg { | |
background-color: #7292fe; | |
} | |
</style> |
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
colorific==0.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment