Closed glurp closed 13 years ago
Hi raubarede,
Try out the following.
require 'green_shoes' Shoes.app do msg = para 'hello', stroke: green button 'new text' do msg.text = 'good bye' end end
Yes, text= do not preserve current color. Sorry, this is a spec (a restriction).
Please set the style again like this:
require 'green_shoes' Shoes.app do msg = para 'hello', stroke: green button 'new text' do msg.text = fg('good bye', green) end end
ashbb
Thank you very much,
Regis,
2011/8/23 ashbb < reply@reply.github.com>
Hi raubarede,
Try out the following.
require 'green_shoes' Shoes.app do msg = para 'hello', stroke: green button 'new text' do msg.text = 'good bye' end endYes, text= do not preserve current color. Sorry, this is a spec (a restriction).
Please set the style again like this:
require 'green_shoes' Shoes.app do msg = para 'hello', stroke: green button 'new text' do msg.text = fg('good bye', green) end endashbb
Reply to this email directly or view it on GitHub: https://github.com/ashbb/green_shoes/issues/45#issuecomment-1880516
_ . _ |) | / ` | /` | \ |_ > L| .__/
http://regisaubarede.posterous.com/
Is this perturbate the specifications (color can be in string) :
class Shoes
class App
[[:bg, :background], [:fg, :foreground]].each do |m, tag|
define_method m do |*str|
color = str.pop
str = str.join
unless String===color # <<<
rgb = "#"+(color[0, 3].map{|e| (e*255.0).to_i}.map{|i| sprintf("%#02X", i)[-2,2]}.join)
else
rgb=color # <<<
end
"<span #{tag}='#{rgb}'>#{str}</span>"
end
end
end
end
Hi raubarede,
Yes, I think your patch works. But there may be a rare case to show slightly different color or no color. After add your patch, try out the following.
require 'green_shoes' Shoes.app do title fg('hello', green) title fg('hello', eval('green')) title fg('hello', 'green') end
On my Windows7, last title is shown with a slightly different color.
require 'green_shoes' Shoes.app do title fg('hello', 'indigo') end
On my Windows7, have an error: should be a color specification, not 'indigo' (GLib::Error)
ashbb
require 'green_shoes' Shoes.app do title 'hello', stroke: green rescue para "nok 1" title 'hello', stroke: "green" rescue para "nok 2" title fg('hello', green) rescue para "nok 1" title fg('hello', eval('green')) rescue para "nok 3" title fg('hello', "green") rescue para "nok 4" title fg('hello', "#00DD00") rescue para "nok 5" end
I get nok 2 and nok 4; other title are ok. seem logic ?
2011/8/24 ashbb < reply@reply.github.com>
Hi raubarede,
Yes, I think your patch works. But there may be a rare case to show slightly different color or no color. After add your patch, try out the following.
require 'green_shoes' Shoes.app do title fg('hello', green) title fg('hello', eval('green')) title fg('hello', 'green') endOn my Windows7, last title is shown with a slightly different color.
require 'green_shoes' Shoes.app do title fg('hello', 'indigo') endOn my Windows7, have an error:
should be a color specification, not 'indigo' (GLib::Error)
ashbb
Reply to this email directly or view it on GitHub: https://github.com/ashbb/green_shoes/issues/45#issuecomment-1888814
_ . _ |) | / ` | /` | \ |_ > L| .__/
http://regisaubarede.posterous.com/
Umm,... did you run the above snippet after adding your patch? I got this screenshot. All 5 titles works. But colors are slightly different.
http://regisaubarede.posterous.com/pages/color-gs
here the screenshot with this code in green-shoes :
[[:bg, :background], [:fg, :foreground]].each do |m, tag|
define_method m do |*str|
color = str.pop
str = str.join
unless String===color
rgb = color[0, 3].map{|e| (e*255.0).to_i}.map{|i|
sprintf("%#02X", i)[-2,2]}.join else rgb=color.gsub('#','') end "<span #{tag}='##{rgb}'>#{str}" end end
2011/8/24 ashbb < reply@reply.github.com>
Umm,... did you run the above snippet after adding your patch? I got this screenshot. All 5 titles works. But colors are slightly different.
Reply to this email directly or view it on GitHub: https://github.com/ashbb/green_shoes/issues/45#issuecomment-1890646
_ . _ |) | / ` | /` | \ |_ > L| .__/
http://regisaubarede.posterous.com/
Hi Regis,
I got it. You have two paches. :)
At first, you showed me this one:
[[:bg, :background], [:fg, :foreground]].each do |m, tag|
define_method m do |*str|
color = str.pop
str = str.join
unless String===color
rgb = '#' + color[0, 3].map{|e| (e*255.0).to_i}.map{|i| sprintf("%#02X", i)[-2,2]}.join
else
rgb=color
end
"#{str}"
end
end
But now you are using this slightly different one:
[[:bg, :background], [:fg, :foreground]].each do |m, tag|
define_method m do |*str|
color = str.pop
str = str.join
unless String===color
rgb = color[0, 3].map{|e| (e*255.0).to_i}.map{|i| sprintf("%#02X", i)[-2,2]}.join
else
rgb=color.gsub('#','')
end
"#{str}"
end
end
So, if you use first patch, you will get the same screenshot that I got.
ashbb
Hello Ashbb,
title is explicit :)
I like to define backgroung /foreground color for some param, but when I modify the text, new text is writing in foreground 'black'.
in this maquette https://gist.github.com/1165270 the fields in status can't be colored...
by