mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 06:47:34 +00:00
Spreadsheet: Allow cells to optionally have static fg/bg colors
This commit is contained in:
parent
1674903dcc
commit
8fa385f774
3 changed files with 19 additions and 0 deletions
|
@ -85,6 +85,20 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role)
|
|||
return Color(Color::Red);
|
||||
}
|
||||
|
||||
if (auto color = cell->type_metadata().static_foreground_color; color.has_value())
|
||||
return color.value();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
if (role == GUI::ModelRole::BackgroundColor) {
|
||||
const auto* cell = m_sheet->at({ m_sheet->column(index.column()), (size_t)index.row() });
|
||||
if (!cell)
|
||||
return {};
|
||||
|
||||
if (auto color = cell->type_metadata().static_background_color; color.has_value())
|
||||
return color.value();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue