I have seen that it is recommended to avoid hard coding colors. Does anyone know what exactly hard coding colors means? Any specific examples are appreciated.
It is best to not hard-code anything on a page that can be better
coded in a CSS file as a class. It just means that if you need to
change anything it is changed once in the CSS file and then all pages
that use that CSS file to define positioning, padding, colours etc.
are all changed at once. It is a code management issue really.
I think that Stephen is on the right track. The person who suggested
to you that colors not be hard coded is likely trying to ensure that
the swapping of one or more colors throughout the system is as
painless as possible. Minimize the amount of find and replace.
There's also a problem from the accessibility standpoint. You can't
know if a user of your product does or does not have some sort of
color-blindness or other visual impariment. The best case for the
user is for every color (and font, and font-size) you use by default
to be customizable to whatever colors work best for them. From the
perspective of an accessibility specialist, any color that cannot
easily be changed by the user is "hard-coded" and a bad usability
experience.
It means forcing your website (or less frequently your desktop
application) to use specific colors for text, alt-text, background,
and so on, rather than allowing the *viewer* to override them with
personal preferences.
The basic problem is that as a designer you want to provide an
aesthetic design in order to convey some additional non-verbal
information. But the visibility impaired reader might really want
high contrast black and white text in a larger font than you
intended. Hard coding screws them over.
Comments
It is best to not hard-code anything on a page that can be better
coded in a CSS file as a class. It just means that if you need to
change anything it is changed once in the CSS file and then all pages
that use that CSS file to define positioning, padding, colours etc.
are all changed at once. It is a code management issue really.
regards
Stephen
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Posted from the new ixda.org
http://www.ixda.org/discuss?post=43676
I think that Stephen is on the right track. The person who suggested
to you that colors not be hard coded is likely trying to ensure that
the swapping of one or more colors throughout the system is as
painless as possible. Minimize the amount of find and replace.
...Dan
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Posted from the new ixda.org
http://www.ixda.org/discuss?post=43676
There's also a problem from the accessibility standpoint. You can't
know if a user of your product does or does not have some sort of
color-blindness or other visual impariment. The best case for the
user is for every color (and font, and font-size) you use by default
to be customizable to whatever colors work best for them. From the
perspective of an accessibility specialist, any color that cannot
easily be changed by the user is "hard-coded" and a bad usability
experience.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Posted from the new ixda.org
http://www.ixda.org/discuss?post=43676
It means forcing your website (or less frequently your desktop
application) to use specific colors for text, alt-text, background,
and so on, rather than allowing the *viewer* to override them with
personal preferences.
The basic problem is that as a designer you want to provide an
aesthetic design in order to convey some additional non-verbal
information. But the visibility impaired reader might really want
high contrast black and white text in a larger font than you
intended. Hard coding screws them over.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Posted from the new ixda.org
http://www.ixda.org/discuss?post=43676