Path: blob/main/_plugins/jekyll-color-picker.rb
1677 views
# frozen_string_literal: true12module Jekyll3module Tags4# Convert a color into a cute little box5class ColorPickerTag < Liquid::Tag6def initialize(tag_name, text, tokens) # :nodoc:7super8@text = text.strip9end1011##12# This function renders the color box13# Params:14# +context+:: The context of the page15#16# Example:17#18# {% color_picker #ff0000 %}19def render(_context)20"<span style='background-color:#{@text};border-radius:3px;border:1px solid #000;width:12px;" \21"height:12px;margin-right:5px;'> </span>"22end23end24end25end2627Liquid::Template.register_tag('color_picker', Jekyll::Tags::ColorPickerTag)282930