mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Make Color::HexString() constexpr (#5985)
Related improvements to wpi::ct_string: * Implicitly convert to std::string * Add operator== for std::string, std::string_view, and const Char*
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "frc/util/Color.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
std::string Color::HexString() const {
|
||||
return fmt::format("#{:02X}{:02X}{:02X}", static_cast<int>(255.0 * red),
|
||||
static_cast<int>(255.0 * green),
|
||||
static_cast<int>(255.0 * blue));
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "frc/util/Color8Bit.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
std::string Color8Bit::HexString() const {
|
||||
return fmt::format("#{:02X}{:02X}{:02X}", red, green, blue);
|
||||
}
|
||||
Reference in New Issue
Block a user