class Pettanr.Views.GroundColor.Symbol extends Backbone.View tagName: 'div' events: { 'click': 'click' } initialize: (options) -> @item = options.item @class_name = options.class_name || 'face' clear: () -> @trigger('ready:symbol', symbol_picture) this render: () -> this.$el.addClass(@class_name) this.$el.html(@fore_color()) attr = { style: Pettanr.to_style(@style()) } this.$el.attr(attr) this fore_color: () -> c = @item.get('code') ^ 0xffffff ('000000' + c.toString(16)).slice(-6) bg_color: () -> c = @item.get('code') ('000000' + c.toString(16)).slice(-6) style: (spot = null, opacity = 20) -> width = Manifest.manifest().magic_numbers['thumbnail_width'] height = Manifest.manifest().magic_numbers['thumbnail_height'] { width: Pettanr.to_s(width) + 'px', height: Pettanr.to_s(height) + 'px', color: '#' + @fore_color() 'background-color': '#' + @bg_color() } click: () -> @trigger('click')