14 std::ofstream stream{path, std::ios::binary};
15 if (!stream.is_open()) {
16 return FormattableError{fmt::format(
"{}: failed to open for writing", path.string())};
19 stream <<
"JASC-PAL\r\n";
21 stream << pal.
size() <<
"\r\n";
23 for (
const auto &color : pal.
colors()) {
24 stream << color.to_jasc_str() <<
"\r\n";
A result type that maintains a chainable sequence of errors for debugging and error reporting.
ChainableResult< void > save(const Palette< Rgba32 > &pal, const std::filesystem::path &path) const override
A palette container for colors that support transparency checking.
const std::vector< ColorType > & colors() const
Returns a const reference to the internal color vector.
std::size_t size() const
Returns the number of colors in the palette.