Twitter::Colour::Picker
1.Add gem 'twitter-colour-picker' to your Gemfile.
gem 'twitter-colour-picker'
2.And then execute:
$ bundle install
Or install it yourself as(local):
$ gem install twitter-colour-picker
Usage
Format | Require |
---|---|
CSS | *= require colour-picker |
JS | //= require colour-picker |
choice color on controller :
#flat colors , source https://flatuicolors.com/
@colors = ["3097d1","1abc9c", "2ecc71","3498db","9b59b6","34495e","f39c12","d35400","c0392b","bdc3c7","7f8c8d","f1c40f"]
views:
<select id='theme_color' style="display:none;">
<% @colors.each do |color|%>
<option value="<%= color %>"><%= color %></option>
<% end %>
</select>
OR:
<%= form.select(:theme_color, options_for_select(@colors, selected: 'user selected'),{},{:class=>"...",:id=>'theme_color',:style=>'display:none;'}) %>
<script>
$(document).ready(function(e){
$('#theme_color').colorpicker({
size: 35,
label: 'Theme Color: ',
hide: false
});
});
</script>
Contributing
For reporting bug, contact me on twitter
License
Copyright (c) 2015 Mohammad Mahmoudi.