colored text with c...
 
Notifications
Clear all

colored text with contrasting colored background

8 Posts
4 Users
0 Reactions
3,199 Views
n8huntsman
Posts: 562
Topic starter
(@n8huntsman)
Honorable Member
Joined: 16 years ago
[#20699]

What is the best way to accomplish this? I can't see to figure it out. I'd like colored text with a contrasting colored background.


7 Replies
chelmuth
Posts: 1077
(@chelmuth)
Noble Member
Joined: 16 years ago

a little more detail on your applications


Reply
macebobo
Posts: 1595
Guest
(@macebobo)
Member
Joined: 17 years ago

If you mean that you want to be able to read the text regardless of the background color, try this:


        public static Color getContrastingColor(Color color)
        {
            int yiq = ((color.R * 299) + (color.G * 587) + (color.B * 114)) / 1000;

            return yiq >= 128 ? Color.Black : Color.White;
        }  

based on YIQ

This will always allow you to read text regardless of the background color. It is in my Utils class on just about any project dealing with color and text.


Reply
n8huntsman
Posts: 562
Topic starter
(@n8huntsman)
Honorable Member
Joined: 16 years ago

I mean, using Nutcracker text class, I'd like to have a green background and have red text scroll across. I thought there was a way to do it without code or layers but I guess not.


Reply
smeighan
Posts: 2595
(@smeighan)
Famed Member
Joined: 15 years ago
n8huntsman wrote:I mean, using Nutcracker text class, I'd like to have a green background and have red text scroll across. I thought there was a way to do it without code or layers but I guess not.

create an effect with the color_wash class. Set start and end color to green
create a text effect with text in red, set duration the same as color_wash above

now use the layer effect
1) color_wash
2) text

and choose that effect 2 takes priority over 1.
i created GREEN_BACKGROUND and MERRY_CHRISTMAS effects in your account.
here is result of layer

Effect Settings
username n8huntsman
user_target 5.125_32_STRINGS
effect_class layer
effect_name RED_TEXT_ON_GREEN
layer_method Pri-2
file1 5.125_32_STRINGS+GREEN_BACKGROUND.nc
file2 5.125_32_STRINGS+MERRY_CHRISTMAS.nc
LAYER_EFFECTS Array
lmethod Pri-2
frame_delay 100
seq_duration 10
fade_in 0
fade_out 0
submit Submit Form to create your effect
OBJECT_NAME layer

RED on GREEN is one of these contrasts that can be hard on the eyes. Maybe darken the green background more?


Reply
smeighan
Posts: 2595
(@smeighan)
Famed Member
Joined: 15 years ago

i did one more pass.
darkened green in color_wash and added 20% sparkles (what the heck?)

Effect Settings
username n8huntsman
user_target 5.125_32_STRINGS
effect_class layer
effect_name RED_TEXT_ON_GREEN2
layer_method Pri-2
file1 5.125_32_STRINGS+GREEN_BACKGROUND_SPARKLE.nc
file2 5.125_32_STRINGS+MERRY_CHRISTMAS.nc
LAYER_EFFECTS Array
lmethod Pri-2
frame_delay 100
seq_duration 10
fade_in 0
fade_out 0
submit Submit Form to create your effect
OBJECT_NAME layer


Reply
macebobo
Posts: 1595
Guest
(@macebobo)
Member
Joined: 17 years ago

When I am in my programming mind, I should really read what sub-forum I am in before responding. DOH!

n8huntsman wrote:I mean, using Nutcracker text class, I'd like to have a green background and have red text scroll across. I thought there was a way to do it without code or layers but I guess not.

Reply
n8huntsman
Posts: 562
Topic starter
(@n8huntsman)
Honorable Member
Joined: 16 years ago

Awesome. Thanks for the help Sean.


Reply
Share: