ash_test_color_generator.cc 865 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/test/ash_test_color_generator.h"
  5. namespace ash {
  6. namespace {
  7. // The array of the candidate colors for app icons.
  8. constexpr std::array<SkColor, 7> kColorArray = {
  9. SK_ColorWHITE, SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE,
  10. SK_ColorYELLOW, SK_ColorCYAN, SK_ColorMAGENTA};
  11. } // namespace
  12. AshTestColorGenerator::AshTestColorGenerator(SkColor default_color)
  13. : default_color_(default_color) {}
  14. AshTestColorGenerator::~AshTestColorGenerator() = default;
  15. SkColor AshTestColorGenerator::GetAlternativeColor() {
  16. const SkColor color = kColorArray[next_color_index_];
  17. next_color_index_ = (next_color_index_ + 1) % kColorArray.size();
  18. return color;
  19. }
  20. } // namespace ash