use super::generated_api::api::style::{ color::Payload as ProtobufColorPayload, Color as ProtobufColor, ColorType as ProtobufColorType, Palette as ProtobufPalette, RgbColorPayload as ProtobufRgbColorPayload, Style as ProtobufStyle, Styling as ProtobufStyling, ThemeHue as ProtobufThemeHue, }; use crate::data::{ MultiplayerColors, Palette, PaletteColor, Style, StyleDeclaration, Styling, ThemeHue, }; use crate::errors::prelude::*; use std::convert::TryFrom; impl TryFrom for Style { type Error = &'static str; fn try_from(protobuf_style: ProtobufStyle) -> Result { let s = protobuf_style .styling .ok_or("malformed style payload")? .try_into()?; Ok(Style { colors: s, rounded_corners: protobuf_style.rounded_corners, hide_session_name: protobuf_style.hide_session_name, // deliberately not carried over the plugin protobuf boundary; see // the field docs on Style. Plugins never need the frame's title // alignment, and adding a proto field would mean regenerating the // committed prost assets. pane_title_alignment: Default::default(), status_bar_button_style: Default::default(), pane_gap_x: Default::default(), pane_gap_y: Default::default(), pane_padding: Default::default(), inactive_pane_grayscale: Default::default(), hide_default_pane_names: Default::default(), }) } } #[allow(deprecated)] impl TryFrom