mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 13:28:16 +08:00

committed by
Phil Scott

parent
9c9eb04f91
commit
e86f9d3c5a
@ -96,6 +96,21 @@ namespace Spectre.Console
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (int.TryParse(part, out var number))
|
||||
{
|
||||
if (number < 0)
|
||||
{
|
||||
error = $"Color number must be greater than or equal to 0 (was {number})";
|
||||
return null;
|
||||
}
|
||||
else if (number > 255)
|
||||
{
|
||||
error = $"Color number must be less than or equal to 255 (was {number})";
|
||||
return null;
|
||||
}
|
||||
|
||||
color = number;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = !foreground
|
||||
|
Reference in New Issue
Block a user