I would, and have, create a Toolkit.lua file, that has as many clever little functions in it that you might ever use. It could have functions to convert text "case" in different ways, format numbers with commas, convert colors between rgb/hex/hsb, convert numbers to text, autoscale numbers, pretty much anything you want. Then you just stick that file in any @Resource folders for skins you might need any of them, and call them as needed, anywhere and as many times as you like in the skin(s), using just one "host" Script measure in the skin.
This file can have hundreds of little functions if you want. None of them are used or expend any resources unless they are "called" in the skin.
Sorry, but I'm just not going to "reinvent the wheel" in every skin I need some function like that, and figure out how to use them multiple times in the same skin without bulking up the code.
This is the beauty of Inline Lua. It's one of the best things we ever did.
It is currently April 27th, 2024, 12:47 am
Converting RGB to HEX with lua
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
-
- Rainmeter Sage
- Posts: 16174
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Converting RGB to HEX with lua
Yes, Inline lua probably has great advantage in front of a "classic" code, which doesn't use a lua code.jsmorley wrote: ↑March 16th, 2019, 3:03 pm I would, and have, create a Toolkit.lua file, that has as many clever little functions in it that you might ever use. It could have functions to convert text "case" in different ways, format numbers with commas, convert colors between rgb/hex/hsb, convert numbers to text, autoscale numbers, pretty much anything you want. Then you just stick that file in any @Resource folders for skins you might need any of them, and call them as needed, anywhere and as many times as you like in the skin(s), using just one "host" Script measure in the skin.
This file can have hundreds of little functions if you want. None of them are used or expend any resources unless they are "called" in the skin.
Sorry, but I'm just not going to "reinvent the wheel" in every skin I need some function like that, and figure out how to use them multiple times in the same skin without bulking up the code.
But where Toolkit.lua is accessible?
-
- Posts: 424
- Joined: February 8th, 2015, 10:07 pm
- Location: EU, Denmark.
Re: Converting RGB to HEX with lua
Sounds very interesting.jsmorley wrote: ↑March 16th, 2019, 3:03 pm I would, and have, create a Toolkit.lua file, that has as many clever little functions in it that you might ever use. It could have functions to convert text "case" in different ways, format numbers with commas, convert colors between rgb/hex/hsb, convert numbers to text, autoscale numbers, pretty much anything you want. Then you just stick that file in any @Resource folders for skins you might need any of them, and call them as needed, anywhere and as many times as you like in the skin(s), using just one "host" Script measure in the skin.
This file can have hundreds of little functions if you want. None of them are used or expend any resources unless they are "called" in the skin.
Sorry, but I'm just not going to "reinvent the wheel" in every skin I need some function like that, and figure out how to use them multiple times in the same skin without bulking up the code.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Converting RGB to HEX with lua
I've never posted mine anywhere. Let me clean it up and add a few other things to it and I will do so in another thread.
-
- Rainmeter Sage
- Posts: 16174
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Converting RGB to HEX with lua
Ok, I wait it.
-
- Rainmeter Sage
- Posts: 5407
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Converting RGB to HEX with lua
Excited to see that release!
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::