Files
StorytellersBestFriend/sbf-cpp/Colors.cpp
Tom Hicks 7d6e9ec6b8 Fixes SetBackgroundColor to return the previous color.
Fixes SetForegroundColor to return the previous color.
Fixes test_Colors to not care about the order of the foreground and background commands.
2023-04-24 14:56:12 -07:00

35 lines
778 B
C++

#include "Colors.h"
namespace SBF {
uint8_t g_foreground_color = kColorDefaultForeground;
uint8_t g_background_color = kColorDefaultBackground;
void FillColors(std::vector<uint8_t>& colors) {
colors.clear();
for (uint8_t color = kColorDarkBlack; color <= kColorBrightWhite; color++) {
colors.push_back(color);
}
}
uint8_t GetBackgroundColor() {
return g_background_color;
}
uint8_t GetForegroundColor() {
return g_foreground_color;
}
uint8_t SetBackgroundColor(uint8_t color) {
uint8_t previous_color = g_background_color;
g_background_color = color;
return previous_color;
}
uint8_t SetForegroundColor(uint8_t color) {
uint8_t previous_color = g_foreground_color;
g_foreground_color = color;
return previous_color;
}
} // End namespace SBF