Add OsuColour method mapping colours from basic theme to mod types

This commit is contained in:
Bartłomiej Dach 2022-02-22 00:02:54 +01:00
parent a5af89d143
commit cd3641137b
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Utils;
@ -157,6 +158,36 @@ namespace osu.Game.Graphics
}
}
/// <summary>
/// Retrieves the main accent colour for a <see cref="ModType"/>.
/// </summary>
public Color4 ForModType(ModType modType)
{
switch (modType)
{
case ModType.Automation:
return Blue1;
case ModType.DifficultyIncrease:
return Red1;
case ModType.DifficultyReduction:
return Lime1;
case ModType.Conversion:
return Purple1;
case ModType.Fun:
return Pink1;
case ModType.System:
return Gray7;
default:
throw new ArgumentOutOfRangeException(nameof(modType), modType, "Unknown mod type");
}
}
/// <summary>
/// Returns a foreground text colour that is supposed to contrast well with
/// the supplied <paramref name="backgroundColour"/>.