| 163 | } |
| 164 | |
| 165 | void ColorTheme::serializeCurrentToJson( Json::Value& root ) |
| 166 | { |
| 167 | assert( ImGui::GetCurrentContext() ); |
| 168 | auto& instance = ColorTheme::instance(); |
| 169 | |
| 170 | std::vector<Color> sceneColors( SceneColors::Count ); |
| 171 | for ( int i = 0; i < SceneColors::Count; ++i ) |
| 172 | sceneColors[i] = SceneColors::get( SceneColors::Type( i ) ); |
| 173 | |
| 174 | const auto& vpParams = Viewer::instanceRef().viewport().getParameters(); |
| 175 | setViewportColor( vpParams.backgroundColor, ViewportColorsType::Background ); |
| 176 | setViewportColor( vpParams.borderColor, ViewportColorsType::Borders ); |
| 177 | |
| 178 | for ( int i = 0; i < SceneColors::Count; ++i ) |
| 179 | serializeToJson( sceneColors[i], root[SceneColors::getName( SceneColors::Type( i ) )] ); |
| 180 | |
| 181 | root["ImGuiPreset"] = getPresetName( instance.themePreset_ ); |
| 182 | |
| 183 | auto& ribbonColors = root["Ribbon Colors"]; |
| 184 | for ( int i = 0; i<int( RibbonColorsType::Count ); ++i ) |
| 185 | serializeToJson( instance.newUIColors_[i], ribbonColors[getRibbonColorTypeName( RibbonColorsType( i ) )] ); |
| 186 | |
| 187 | auto& vieportColors = root["Viewport Colors"]; |
| 188 | for ( int i = 0; i<int( ViewportColorsType::Count ); ++i ) |
| 189 | serializeToJson( instance.viewportColors_[i], vieportColors[getViewportColorTypeName( ViewportColorsType( i ) )] ); |
| 190 | } |
| 191 | |
| 192 | void ColorTheme::apply_( const std::vector<Color>& sceneColors ) |
| 193 | { |
nothing calls this directly
no test coverage detected