darhal Posted April 5, 2015 Share Posted April 5, 2015 as the title said how to convert r g b to hex ? thx Link to comment
Dimos7 Posted April 5, 2015 Share Posted April 5, 2015 you mean like r, g, b = 000000? Link to comment
darhal Posted April 5, 2015 Author Share Posted April 5, 2015 (edited) No r, g, b convert it to #FFFFFF smthg like this Edited April 5, 2015 by Guest Link to comment
darhal Posted April 5, 2015 Author Share Posted April 5, 2015 Thx You are the best ever Link to comment
WhoAmI Posted April 5, 2015 Share Posted April 5, 2015 No problemo, thanks (even if it's not true). Link to comment
Et-win Posted April 5, 2015 Share Posted April 5, 2015 string.format("%.2X%.2X%.2X", R, G, B) Link to comment
darhal Posted April 5, 2015 Author Share Posted April 5, 2015 Wait i want to convert r g b to hex to use it in a string i want 3 different colors in one string any examples ? Link to comment
Dimos7 Posted April 5, 2015 Share Posted April 5, 2015 local hexColor = string.format("#%, 2X%, 2X%, 2X", r, g , b) Link to comment
darhal Posted April 5, 2015 Author Share Posted April 5, 2015 How to use it inside a string ? Link to comment
WhoAmI Posted April 5, 2015 Share Posted April 5, 2015 local r,g,b = 255, 0, 0; outputChatBox ( string.format("#%, 2X%, 2X%, 2X", r, g , b) .. "Red string", 255, 255, 255, true ); Link to comment
Et-win Posted April 5, 2015 Share Posted April 5, 2015 Example: string1 = string.format("%.2X%.2X%.2X", 255, 0, 0).."Red" string2 = string.format("%.2X%.2X%.2X", 0, 255, 0).."Green" string3 = string.format("%.2X%.2X%.2X", 0, 0, 255).."Blue" outputChatBox(string1..", "..string2..", "..string3, 255, 255, 255, true) --Same as: string1 = string.format("%.2X%.2X%.2X", 255, 0, 0) string2 = string.format("%.2X%.2X%.2X", 0, 255, 0) string3 = string.format("%.2X%.2X%.2X", 0, 0, 255) outputChatBox(string1.."Red, "..string2.."Green, "..string3.."Blue", 255, 255, 255, true) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now