Giter VIP home page Giter VIP logo

Comments (8)

ashbb avatar ashbb commented on August 23, 2024

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

from green_shoes.

glurp avatar glurp commented on August 23, 2024

Thank you very much,

Regis,

2011/8/23 ashbb <
[email protected]>

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

Reply to this email directly or view it on GitHub:
#45 (comment)


__ ___ __ . __
|) | / | /__
| \ |
__ > L| ./

http://regisaubarede.posterous.com/


from green_shoes.

glurp avatar glurp commented on August 23, 2024

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

from green_shoes.

ashbb avatar ashbb commented on August 23, 2024

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

from green_shoes.

glurp avatar glurp commented on August 23, 2024

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 <
[email protected]>

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

Reply to this email directly or view it on GitHub:
#45 (comment)


__ ___ __ . __
|) | / | /__
| \ |
__ > L| ./

http://regisaubarede.posterous.com/


from green_shoes.

ashbb avatar ashbb commented on August 23, 2024

Umm,... did you run the above snippet after adding your patch?
I got this screenshot. All 5 titles works. But colors are slightly different.

from green_shoes.

glurp avatar glurp commented on August 23, 2024

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 <
[email protected]>

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:
#45 (comment)


__ ___ __ . __
|) | / | /__
| \ |
__ > L| ./

http://regisaubarede.posterous.com/


from green_shoes.

ashbb avatar ashbb commented on August 23, 2024

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

from green_shoes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.