Module: ExtJS::XTheme::Effects

Defined in:
lib/extjs-xtheme/effects.rb

Class Method Summary collapse

Class Method Details

.modulate(ext_dir, theme_dir, hue = 1.0, saturation = 1.0, lightness = 1.0) ⇒ Object

performs hsv transformation on Ext theme images and save to Sass theme dir.

Parameters:

  • name (String)

    Theme name

  • ext_dir (String)

    path to Ext directory relative to public/javascripts

  • hue (Float) (defaults to: 1.0)
  • saturation (Float) (defaults to: 1.0)
  • lightneess (Float)


12
13
14
15
16
17
18
19
# File 'lib/extjs-xtheme/effects.rb', line 12

def self.modulate(ext_dir, theme_dir, hue=1.0, saturation=1.0, lightness=1.0)
  each_image("#{ext_dir}/resources/images/default") {|img|
    write_image(img.modulate(lightness, saturation, hue), theme_dir)
  }
  # update hue in defines.sass
  defines = File.read("#{theme_dir}/defines.sass")
  File.open("#{theme_dir}/defines.sass", "w+") {|f| f << defines.gsub(/hue\s?=.*/, "hue = #{(hue-1)*180}") }
end