<commit_before>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osuTK.Graphics;

namespace osu.Game.Beatmaps.Drawables
{
    public abstract class DifficultyColouredContainer : Container, IHasAccentColour
    {
        public Color4 AccentColour { get; set; }

        private readonly BeatmapInfo beatmap;
        private OsuColour palette;

        protected DifficultyColouredContainer(BeatmapInfo beatmap)
        {
            this.beatmap = beatmap;
        }

        [BackgroundDependencyLoader]
        private void load(OsuColour palette)
        {
            if (palette == null)
                throw new ArgumentNullException(nameof(palette));

            this.palette = palette;
            AccentColour = getColour(beatmap);
        }

        private enum DifficultyRating
        {
            Easy,
            Normal,
            Hard,
            Insane,
            Expert,
            ExpertPlus
        }

        private DifficultyRating getDifficultyRating(BeatmapInfo beatmap)
        {
            if (beatmap == null)
                throw new ArgumentNullException(nameof(beatmap));

            var rating = beatmap.StarDifficulty;

            if (rating < 1.5) return DifficultyRating.Easy;
            if (rating < 2.25) return DifficultyRating.Normal;
            if (rating < 3.75) return DifficultyRating.Hard;
            if (rating < 5.25) return DifficultyRating.Insane;
            if (rating < 6.75) return DifficultyRating.Expert;
            return DifficultyRating.ExpertPlus;
        }

        private Color4 getColour(BeatmapInfo beatmap)
        {
            switch (getDifficultyRating(beatmap))
            {
                case DifficultyRating.Easy:
                    return palette.Green;
                default:
                case DifficultyRating.Normal:
                    return palette.Blue;
                case DifficultyRating.Hard:
                    return palette.Yellow;
                case DifficultyRating.Insane:
                    return palette.Pink;
                case DifficultyRating.Expert:
                    return palette.Purple;
                case DifficultyRating.ExpertPlus:
                    return palette.Gray0;
            }
        }
    }
}
<commit_msg>Update difficulty color bracket thresholds<commit_after>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osuTK.Graphics;

namespace osu.Game.Beatmaps.Drawables
{
    public abstract class DifficultyColouredContainer : Container, IHasAccentColour
    {
        public Color4 AccentColour { get; set; }

        private readonly BeatmapInfo beatmap;
        private OsuColour palette;

        protected DifficultyColouredContainer(BeatmapInfo beatmap)
        {
            this.beatmap = beatmap;
        }

        [BackgroundDependencyLoader]
        private void load(OsuColour palette)
        {
            if (palette == null)
                throw new ArgumentNullException(nameof(palette));

            this.palette = palette;
            AccentColour = getColour(beatmap);
        }

        private enum DifficultyRating
        {
            Easy,
            Normal,
            Hard,
            Insane,
            Expert,
            ExpertPlus
        }

        private DifficultyRating getDifficultyRating(BeatmapInfo beatmap)
        {
            if (beatmap == null)
                throw new ArgumentNullException(nameof(beatmap));

            var rating = beatmap.StarDifficulty;

            if (rating < 2.0) return DifficultyRating.Easy;
            if (rating < 2.7) return DifficultyRating.Normal;
            if (rating < 4.0) return DifficultyRating.Hard;
            if (rating < 5.3) return DifficultyRating.Insane;
            if (rating < 6.5) return DifficultyRating.Expert;
            return DifficultyRating.ExpertPlus;
        }

        private Color4 getColour(BeatmapInfo beatmap)
        {
            switch (getDifficultyRating(beatmap))
            {
                case DifficultyRating.Easy:
                    return palette.Green;
                default:
                case DifficultyRating.Normal:
                    return palette.Blue;
                case DifficultyRating.Hard:
                    return palette.Yellow;
                case DifficultyRating.Insane:
                    return palette.Pink;
                case DifficultyRating.Expert:
                    return palette.Purple;
                case DifficultyRating.ExpertPlus:
                    return palette.Gray0;
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.06563317898127642, 'fraction_numerical': 0.006039863096436481, 'mean_word_length': 1.6926829268292682, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4624735', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1268, 'n_words': 312}