swh:1:snp:6088ab52ef49920e01e3f334cdf4d5d6c8a822b9
Raw File
Tip revision: 9477ea5f4ef8ea3b617a17cacaaab8da9c52af8a authored by Norbert Grunwald on 09 September 2021, 12:46:32 UTC
update reference files
Tip revision: 9477ea5
Color.h
/**
 * \file
 * \author Karsten Rink
 * \date   2010-02-04
 * \brief  Definition of the Color class.
 *
 * \copyright
 * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 *
 */

#pragma once

#include <array>
#include <map>
#include <string>

namespace DataHolderLib
{
using Color = std::array<unsigned char, 4>;

Color createColor(unsigned char r,
                  unsigned char g,
                  unsigned char b,
                  unsigned char a = 255);

/// Returns a random RGB colour.
Color getRandomColor();

/// Uses a color-lookup-table (in form of a map) to return a colour for a specified name. If the name is not
/// in the colortable a new entry is created with the new name and a random colour.
Color getColor(const std::string& id,
               std::map<std::string, DataHolderLib::Color>& colors);

}  // namespace DataHolderLib
back to top