I don't think subtracting a single integer from a colour that stores four makes any sense. It's worse that it doesn't even affect all four, just a chosen three. It's not intuitive. Normally if you want a different colour, you would state the colour you want.
However, since alpha is a single value, this is the most obvious use for the this calculation. I'm not saying it should do this but sf::Color::Green - 20 looks more like the alpha should be reduced by that amount.
I don't understand why the so-called verbose version is bad.
Even if you do think it's ugly, you could always use a function for this.
// simple functions solution
sf::Color offsetGray(const sf::Uint8 value)
{
return sf::Color(value, value, value, 0);
}
// simple and clear usage
const sf::Color darkGreen = sf::Color::Green - offsetGray(127);
const sf::Color palerBlue = sf::Color::Blue + offsetGray(64);;
In fact, you could simply just create a colour from a single value:
const sf::Color darkGreen = sf::Color::Green - sf::Color(0x7f7f7f00);
const sf::Color palerBlue = sf::Color::Blue + sf::Color(0x40404000);
You also mention in your issue that you think there could be a float-based colour class
and an integer-based colour class. That's obviously too confusing and there isn't really much need for it in SFML since you can build your own and convert to SFML colour when you actually use it with SFML. In fact,
that's exactly what I did As for the scaling operator, you can simply add this yourself if you
must have it; you don't need to modify SFML:
sf::Color operator*(const sf::Color color, const float scalar)
{
return sf::Color(static_cast<sf::Uint8>(color.r * scalar), static_cast<sf::Uint8>(color.g * scalar), static_cast<sf::Uint8>(color.b * scalar), color.a);
}
or
sf::Color operator*(const sf::Color color, const sf::Uint8 value)
{
const float scalar = value / 255.f;
return sf::Color(static_cast<sf::Uint8>(color.r * scalar), static_cast<sf::Uint8>(color.g * scalar), static_cast<sf::Uint8>(color.b * scalar), color.a);
}
You can, of course, also add the addition and subtract operators if you don't like my other simple method :p :
sf::Color operator+(const sf::Color color, const sf::Uint8 value)
{
return sf::Color(color.r + value, color.g + value, color.b + value, color.a);
}
sf::Color operator-(const sf::Color color, const sf::Uint8 value)
{
return sf::Color(color.r - value, color.g - value, color.b - value, color.a);
}
Again, in your own code without SFML being modified.
You may also want to consider the possibility of having some form of
linear interpolation between colours. Pretty useful for "mixing" colours.