https://gitlab.opengeosys.org/ogs/ogs.git
Tip revision: 15a89cd98a1802fc7200bb6bc3f92965cc7f8e7e authored by Dmitri Naumov on 18 December 2020, 16:35:51 UTC
Enable C++20 standard.
Enable C++20 standard.
Tip revision: 15a89cd
Color.h
/**
* \file
* \author Karsten Rink
* \date 2010-02-04
* \brief Definition of the Color class.
*
* \copyright
* Copyright (c) 2012-2020, 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