✅ Help 2.0

Color accentColor = Properties.Settings.Default.accentColor;
string color = accentColor.ToString();
Color accentColor = Properties.Settings.Default.accentColor;
string color = accentColor.ToString();
This returns "Color [Red]" How do I make it return "Red"?
6 Replies
Jimmacle
Jimmacle2mo ago
by manipulating the string to cut out the parts you don't want, that's just how ToString works for that type
Buddy
Buddy2mo ago
Please don't name your thread "help" in the future, but be more descriptive
Jimmacle
Jimmacle2mo ago
public override string ToString() =>
IsNamedColor ? $"{nameof(Color)} [{Name}]" :
(state & StateValueMask) != 0 ? $"{nameof(Color)} [A={A}, R={R}, G={G}, B={B}]" :
$"{nameof(Color)} [Empty]";
public override string ToString() =>
IsNamedColor ? $"{nameof(Color)} [{Name}]" :
(state & StateValueMask) != 0 ? $"{nameof(Color)} [A={A}, R={R}, G={G}, B={B}]" :
$"{nameof(Color)} [Empty]";
Gυαɾԃιαɳ
GυαɾԃιαɳOP2mo ago
Sorry. It wont happen again Would this affect my other ToStrings?
Jimmacle
Jimmacle2mo ago
that isn't code for you to use that's the implemention of ToString for Color
Gυαɾԃιαɳ
GυαɾԃιαɳOP2mo ago
oo ok Ill use it to my advantage. Thanks for the help. Adios!
Want results from more Discord servers?
Add your server