Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d21765
commit 52fee43
Showing
4 changed files
with
25 additions
and
17 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hexo-tag-color-block* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
# hexo-tag-color-block | ||
|
||
Create Color Block Easily on Hexo | ||
|
||
usage: `{% colorblock [color hex code] [width] %}` | ||
# hexo-tag-color-block | ||
|
||
Create Color Block Easily on Hexo | ||
|
||
usage: `{% colorblock [color hex code] [width] %}` | ||
|
||
example: `{% colorblock #f8dcf8 %}` will generate: | ||
![example of #f8dcf8](example) | ||
|
||
## License | ||
|
||
MIT. |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
hexo.extend.tag.register('colorblock', function(args){ | ||
var config = hexo.config.colorblock || {}; | ||
config.width = config.width || 10; | ||
var color = parseInt(args[0]); | ||
var width = parseInt(args[1]) || config.width; | ||
return '<svg width="' | ||
+ width +'" height="' | ||
+ width +'"><rect width="' | ||
+ width + '" height="' | ||
+ width + '" fill="' | ||
+ color + '"/></svg> ' | ||
+color; | ||
hexo.extend.tag.register('colorblock', function(args){ | ||
var config = hexo.config.colorblock || {}; | ||
config.width = config.width || 10; | ||
var color = args[0]; | ||
var width = parseInt(args[1]) || config.width; | ||
return '<svg width="' | ||
+ width +'" height="' | ||
+ width +'"><rect width="' | ||
+ width + '" height="' | ||
+ width + '" fill="' | ||
+ color + '"/></svg> ' | ||
+color; | ||
}); |