Added export button to palette library. - icy_draw - icy_draw is the successor to mystic draw. fork / mirror
 (HTM) git clone https://git.drkhsh.at/icy_draw.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 084fc722a761bf1b0e70a518916b30374d126cf8
 (DIR) parent 9578ac426a35f5a8f2c371fa787f57133efcf72c
 (HTM) Author: Mike Krüger <mkrueger@posteo.de>
       Date:   Sun, 17 Sep 2023 10:43:59 +0200
       
       Added export button to palette library.
       
       Fixes issue #26
       
       Diffstat:
         M i18n/de/icy_draw.ftl                |       3 ---
         M i18n/en/icy_draw.ftl                |       3 ---
         M src/ui/dialogs/select_palette_dial… |      40 ++++++++++++++++++++++++++++---
         M src/ui/main_window.rs               |      57 ++-----------------------------
         M src/ui/mod.rs                       |       3 ---
         D src/ui/palette/ansi32.ase           |       0 
         D src/ui/palette/ansi32.gpl           |      36 -------------------------------
         D src/ui/palette/ansi32.hex           |      32 -------------------------------
         D src/ui/palette/ansi32.pal           |      35 -------------------------------
         D src/ui/palette/ansi32.txt           |      37 -------------------------------
         D src/ui/palette/mod.rs               |     247 -------------------------------
         M src/ui/palette_editor.rs            |       9 +++++----
         M src/ui/settings.rs                  |      19 +------------------
       
       13 files changed, 45 insertions(+), 476 deletions(-)
       ---
 (DIR) diff --git a/i18n/de/icy_draw.ftl b/i18n/de/icy_draw.ftl
       @@ -169,9 +169,6 @@ anchor_layer_tooltip = Ebene verankern
        glyph-char-label=Zeichen
        glyph-font-label=Schriftart
        
       -color-dos=DOS
       -color-ext=ERW
       -color-custom=USR
        color-is_blinking=Blinken
        
        export-title=Export
 (DIR) diff --git a/i18n/en/icy_draw.ftl b/i18n/en/icy_draw.ftl
       @@ -168,9 +168,6 @@ anchor_layer_tooltip = Anchor layer
        glyph-char-label=Char
        glyph-font-label=Font
        
       -color-dos=DOS
       -color-ext=EXT
       -color-custom=USR
        color-is_blinking=Blink
        
        export-title=Export
 (DIR) diff --git a/src/ui/dialogs/select_palette_dialog.rs b/src/ui/dialogs/select_palette_dialog.rs
       @@ -4,11 +4,12 @@ use eframe::{
            egui::{self, Response, Sense, TextEdit, WidgetText},
            epaint::{Color32, FontFamily, FontId, Pos2, Rect, Rounding, Stroke, Vec2},
        };
       +use egui_file::FileDialog;
        use egui_modal::Modal;
        use i18n_embed_fl::fl;
        use icy_engine::{
            Palette, C64_DEFAULT_PALETTE, DOS_DEFAULT_PALETTE, EGA_PALETTE, VIEWDATA_PALETTE,
       -    XTERM_256_PALETTE,
       +    XTERM_256_PALETTE, PaletteFormat,
        };
        use walkdir::WalkDir;
        
       @@ -31,6 +32,8 @@ pub struct SelectPaletteDialog {
        
            do_select: bool,
            edit_selected_font: bool,
       +
       +    export_dialog: Option<FileDialog>,
        }
        
        impl SelectPaletteDialog {
       @@ -100,6 +103,7 @@ impl SelectPaletteDialog {
                    show_library: true,
                    show_file: true,
                    edit_selected_font: false,
       +            export_dialog: None,
                })
            }
        
       @@ -303,6 +307,25 @@ impl SelectPaletteDialog {
        
        impl crate::ModalDialog for SelectPaletteDialog {
            fn show(&mut self, ctx: &egui::Context) -> bool {
       +        if let Some(ed) = &mut self.export_dialog {
       +            if ed.show(ctx).selected() {
       +                if let Some(res) = ed.path() {
       +                    let s  =self.selected_palette as usize;
       +                    if s < self.palettes.len() {
       +                        let res = res.with_extension("gpl");
       +                        let data = self.palettes[s].0.export_palette(&PaletteFormat::Gpl);
       +                        if let Err(err)= fs::write(res, data) {
       +                            log::error!("Error exporting palette: {err}");
       +                        }
       +                    }
       +                }
       +                self.export_dialog = None
       +            } else {
       +                return false;
       +            }
       +        }
       +
       +
                let mut result = false;
                let modal = Modal::new(ctx, "select_font_dialog2");
                let palette_count = self.palettes.len();
       @@ -416,10 +439,21 @@ impl crate::ModalDialog for SelectPaletteDialog {
                            result = true;
                        }
                        if ui
       -                    .button(fl!(crate::LANGUAGE_LOADER, "new-file-cancel"))
       +                .button(fl!(crate::LANGUAGE_LOADER, "new-file-cancel"))
       +                .clicked()
       +            {
       +                result = true;
       +            }
       +
       +                if ui
       +                    .button(fl!(crate::LANGUAGE_LOADER, "export-button-title"))
                            .clicked()
                        {
       -                    result = true;
       +                    let mut initial_path = None;
       +                    crate::set_default_initial_directory_opt(&mut initial_path);
       +                    let mut dialog = FileDialog::save_file(initial_path);
       +                    dialog.open();
       +                    self.export_dialog = Some(dialog);
                        }
                    });
                });
 (DIR) diff --git a/src/ui/main_window.rs b/src/ui/main_window.rs
       @@ -35,7 +35,6 @@ pub struct MainWindow {
            dialog_open: bool,
            modal_dialog: Option<Box<dyn ModalDialog>>,
            id: usize,
       -    palette_mode: usize,
            pub is_closed: bool,
            pub top_bar: TopBar,
            pub left_panel: bool,
       @@ -201,7 +200,6 @@ impl MainWindow {
                    left_panel: true,
                    right_panel: true,
                    bottom_panel: false,
       -            palette_mode: 0,
                    top_bar: TopBar::new(&cc.egui_ctx),
                    commands: Commands::default(),
                    is_closed: false,
       @@ -569,7 +567,6 @@ impl eframe::App for MainWindow {
                    .show_animated(ctx, self.left_panel, |ui| {
                        ui.add_space(8.0);
                        let mut msg = None;
       -                let mut palette_mode: usize = self.palette_mode;
        
                        let mut caret_attr = TextAttribute::default();
                        let mut palette = Palette::default();
       @@ -590,55 +587,9 @@ impl eframe::App for MainWindow {
                        ui.vertical_centered(|ui| {
                            msg = crate::palette_switcher(ctx, ui, &caret_attr, &palette);
                        });
       -                ui.add_space(8.0);
       -                if buffer_type.has_extended_colors() || buffer_type.has_rgb_colors() {
       -                    ui.horizontal(|ui| {
       -                        ui.add_space(8.0);
       -                        if ui
       -                            .selectable_label(
       -                                palette_mode == 0,
       -                                fl!(crate::LANGUAGE_LOADER, "color-dos"),
       -                            )
       -                            .clicked()
       -                        {
       -                            palette_mode = 0;
       -                        }
       -                        if buffer_type.has_extended_colors() {
       -                            if ui
       -                                .selectable_label(
       -                                    palette_mode == 1,
       -                                    fl!(crate::LANGUAGE_LOADER, "color-ext"),
       -                                )
       -                                .clicked()
       -                            {
       -                                palette_mode = 1;
       -                            }
       -                        } else if palette_mode == 1 {
       -                            palette_mode = 0;
       -                        }
       -                        if buffer_type.has_rgb_colors() {
       -                            if ui
       -                                .selectable_label(
       -                                    palette_mode == 2,
       -                                    fl!(crate::LANGUAGE_LOADER, "color-custom"),
       -                                )
       -                                .clicked()
       -                            {
       -                                palette_mode = 2;
       -                            }
       -                        } else if palette_mode == 2 {
       -                            palette_mode = 0;
       -                        }
       -                    });
       -                } else {
       -                    palette_mode = 0;
       -                }
       +              
                        ui.separator();
       -                let msg2 = match palette_mode {
       -                    0 => crate::palette_editor_16(ui, &caret_attr, &palette, buffer_type),
       -                    1 => crate::show_extended_palette(ui),
       -                    _ => crate::show_custom_palette(ui),
       -                };
       +                crate::palette_editor_16(ui, &caret_attr, &palette, buffer_type);
        
                        if buffer_type.has_blink()
                            && ui
       @@ -660,12 +611,8 @@ impl eframe::App for MainWindow {
                            }
                        }
        
       -                if msg.is_none() {
       -                    msg = msg2;
       -                }
                        ui.separator();
        
       -                self.palette_mode = palette_mode;
                        self.handle_message(msg);
        
                        crate::add_tool_switcher(ctx, ui, self);
 (DIR) diff --git a/src/ui/mod.rs b/src/ui/mod.rs
       @@ -41,9 +41,6 @@ pub use tools::*;
        mod commands;
        pub use commands::*;
        
       -mod palette;
       -pub use palette::*;
       -
        pub type TerminalResult<T> = anyhow::Result<T>;
        
        pub trait ModalDialog {
 (DIR) diff --git a/src/ui/palette/ansi32.ase b/src/ui/palette/ansi32.ase
       Binary files differ.
 (DIR) diff --git a/src/ui/palette/ansi32.gpl b/src/ui/palette/ansi32.gpl
       @@ -1,36 +0,0 @@
       -GIMP Palette
       -#Palette Name: ANSI32
       -#Description: All 16 original EGA ANSI art colors and 16 more in-between. I averaged these to find 8 darker and 8 lighter colors to complement the originals.
       -#Colors: 32
       -0        0        0        000000
       -0        0        163        0000a3
       -0        55        209        0037d1
       -75        76        255        4b4cff
       -145        164        240        91a4f0
       -76        255        255        4cffff
       -172        255        255        acffff
       -0        163        163        00a3a3
       -0        71        70        004746
       -12        56        12        0c380c
       -0        119        1        007701
       -76        255        77        4cff4d
       -197        255        197        c5ffc5
       -223        223        223        dfdfdf
       -202        202        202        cacaca
       -163        163        163        a3a3a3
       -112        112        112        707070
       -76        76        76        4c4c4c
       -41        41        41        292929
       -119        56        0        773800
       -220        106        0        dc6a00
       -255        163        0        ffa300
       -254        71        70        fe4746
       -194        0        0        c20000
       -119        0        0        770000
       -118        41        121        762979
       -204        41        204        cc29cc
       -255        76        254        ff4cfe
       -255        157        255        ff9dff
       -239        187        187        efbbbb
       -255        242        140        fff28c
       -255        255        255        ffffff
 (DIR) diff --git a/src/ui/palette/ansi32.hex b/src/ui/palette/ansi32.hex
       @@ -1,32 +0,0 @@
       -000000
       -0000a3
       -0037d1
       -4b4cff
       -91a4f0
       -4cffff
       -acffff
       -00a3a3
       -004746
       -0c380c
       -007701
       -4cff4d
       -c5ffc5
       -dfdfdf
       -cacaca
       -a3a3a3
       -707070
       -4c4c4c
       -292929
       -773800
       -dc6a00
       -ffa300
       -fe4746
       -c20000
       -770000
       -762979
       -cc29cc
       -ff4cfe
       -ff9dff
       -efbbbb
       -fff28c
       -ffffff
 (DIR) diff --git a/src/ui/palette/ansi32.pal b/src/ui/palette/ansi32.pal
       @@ -1,35 +0,0 @@
       -JASC-PAL
       -0100
       -32
       -0 0 0
       -0 0 163
       -0 55 209
       -75 76 255
       -145 164 240
       -76 255 255
       -172 255 255
       -0 163 163
       -0 71 70
       -12 56 12
       -0 119 1
       -76 255 77
       -197 255 197
       -223 223 223
       -202 202 202
       -163 163 163
       -112 112 112
       -76 76 76
       -41 41 41
       -119 56 0
       -220 106 0
       -255 163 0
       -254 71 70
       -194 0 0
       -119 0 0
       -118 41 121
       -204 41 204
       -255 76 254
       -255 157 255
       -239 187 187
       -255 242 140
       -255 255 255
 (DIR) diff --git a/src/ui/palette/ansi32.txt b/src/ui/palette/ansi32.txt
       @@ -1,37 +0,0 @@
       -;paint.net Palette File
       -;Downloaded from Lospec.com/palette-list
       -;Palette Name: ANSI32
       -;Description: All 16 original EGA ANSI art colors and 16 more in-between. I averaged these to find 8 darker and 8 lighter colors to complement the originals.
       -;Colors: 32
       -FF000000
       -FF0000a3
       -FF0037d1
       -FF4b4cff
       -FF91a4f0
       -FF4cffff
       -FFacffff
       -FF00a3a3
       -FF004746
       -FF0c380c
       -FF007701
       -FF4cff4d
       -FFc5ffc5
       -FFdfdfdf
       -FFcacaca
       -FFa3a3a3
       -FF707070
       -FF4c4c4c
       -FF292929
       -FF773800
       -FFdc6a00
       -FFffa300
       -FFfe4746
       -FFc20000
       -FF770000
       -FF762979
       -FFcc29cc
       -FFff4cfe
       -FFff9dff
       -FFefbbbb
       -FFfff28c
       -FFffffff
 (DIR) diff --git a/src/ui/palette/mod.rs b/src/ui/palette/mod.rs
       @@ -1,247 +0,0 @@
       -use regex::Regex;
       -use serde::{Deserialize, Serialize};
       -#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq)]
       -pub struct IceColor {
       -    pub name: Option<String>,
       -    pub color: (u8, u8, u8),
       -}
       -
       -impl IceColor {
       -    pub fn get_rgb(&self) -> (u8, u8, u8) {
       -        self.color
       -    }
       -
       -    pub(crate) fn get_name(&self) -> String {
       -        if let Some(name) = &self.name {
       -            name.clone()
       -        } else {
       -            self.get_rgb_text()
       -        }
       -    }
       -
       -    pub(crate) fn get_rgb_text(&self) -> String {
       -        let (r, g, b) = self.get_rgb();
       -        format!("#{:02x}{:02x}{:02x}", r, g, b)
       -    }
       -
       -    pub fn from_rgb(r: u8, g: u8, b: u8) -> IceColor {
       -        IceColor {
       -            name: None,
       -            color: (r, g, b),
       -        }
       -    }
       -
       -    pub fn set_name(&mut self, name: String) {
       -        if name.is_empty() {
       -            self.name = None;
       -        } else {
       -            self.name = Some(name);
       -        }
       -    }
       -
       -    pub(crate) fn set_rgb(&mut self, r: u8, g: u8, b: u8) {
       -        self.color = (r, g, b);
       -    }
       -}
       -
       -#[derive(Serialize, Deserialize, Debug, Default, PartialEq)]
       -pub struct IcePalette {
       -    pub title: String,
       -    pub description: String,
       -    pub colors: Vec<IceColor>,
       -}
       -
       -pub enum PaletteFormat {
       -    Hex,
       -    Pal,
       -    Gpl,
       -    Txt,
       -    Ase,
       -}
       -
       -impl IcePalette {
       -    pub fn is_empty(&self) -> bool {
       -        self.colors.is_empty()
       -    }
       -
       -    pub fn len(&self) -> usize {
       -        self.colors.len()
       -    }
       -
       -    pub fn push_rgb(&mut self, r: u8, g: u8, b: u8) {
       -        self.colors.push(IceColor::from_rgb(r, g, b));
       -    }
       -
       -    pub fn load_palette(format: PaletteFormat, bytes: &[u8]) -> anyhow::Result<Self> {
       -        let mut colors = Vec::new();
       -        let mut title = String::new();
       -        let mut description = String::new();
       -        match format {
       -            PaletteFormat::Hex => match String::from_utf8(bytes.to_vec()) {
       -                Ok(data) => {
       -                    let re = Regex::new(r"([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})")?;
       -                    for (_, [r, g, b]) in re.captures_iter(&data).map(|c| c.extract()) {
       -                        let r = u32::from_str_radix(r, 16)?;
       -                        let g = u32::from_str_radix(g, 16)?;
       -                        let b = u32::from_str_radix(b, 16)?;
       -                        colors.push(IceColor::from_rgb(r as u8, g as u8, b as u8));
       -                    }
       -                }
       -                Err(err) => return Err(anyhow::anyhow!("Invalid input: {err}")),
       -            },
       -            PaletteFormat::Pal => {
       -                match String::from_utf8(bytes.to_vec()) {
       -                    Ok(data) => {
       -                        let re = Regex::new(r"(\d+)\s+(\d+)\s+(\d+)")?;
       -
       -                        for (i, line) in data.lines().enumerate() {
       -                            match i {
       -                                0 => {
       -                                    if line != "JASC-PAL" {
       -                                        return Err(anyhow::anyhow!(
       -                                            "Only JASC-PAL supported: {line}"
       -                                        ));
       -                                    }
       -                                }
       -                                1 | 2 => {
       -                                    // Ignore
       -                                }
       -                                _ => {
       -                                    for (_, [r, g, b]) in
       -                                        re.captures_iter(line).map(|c| c.extract())
       -                                    {
       -                                        let r = r.parse::<u32>()?;
       -                                        let g = g.parse::<u32>()?;
       -                                        let b = b.parse::<u32>()?;
       -                                        colors.push(IceColor::from_rgb(r as u8, g as u8, b as u8));
       -                                    }
       -                                }
       -                            }
       -                        }
       -                    }
       -                    Err(err) => return Err(anyhow::anyhow!("Invalid input: {err}")),
       -                }
       -            }
       -            PaletteFormat::Gpl => match String::from_utf8(bytes.to_vec()) {
       -                Ok(data) => {
       -                    let color_regex = Regex::new(r"(\d+)\s+(\d+)\s+(\d+)\s+\S+")?;
       -                    let name_regex = Regex::new(r"\s*#Palette Name:\s*(.*)\s*")?;
       -                    let description_regex = Regex::new(r"\s*#Description:\s*(.*)\s*")?;
       -                    for (i, line) in data.lines().enumerate() {
       -                        match i {
       -                            0 => {
       -                                if line != "GIMP Palette" {
       -                                    return Err(anyhow::anyhow!(
       -                                        "Only GIMP Palette supported: {line}"
       -                                    ));
       -                                }
       -                            }
       -                            _ => {
       -                                if line.starts_with('#') {
       -                                    if let Some(cap) = name_regex.captures(line) {
       -                                        if let Some(name) = cap.get(1) {
       -                                            title = name.as_str().to_string();
       -                                        }
       -                                    }
       -                                    if let Some(cap) = description_regex.captures(line) {
       -                                        if let Some(name) = cap.get(1) {
       -                                            description = name.as_str().to_string();
       -                                        }
       -                                    }
       -                                } else if let Some(cap) = color_regex.captures(line) {
       -                                    let (_, [r, g, b]) = cap.extract();
       -
       -                                    let r = r.parse::<u32>()?;
       -                                    let g = g.parse::<u32>()?;
       -                                    let b = b.parse::<u32>()?;
       -                                    colors.push(IceColor::from_rgb(r as u8, g as u8, b as u8));
       -                                }
       -                            }
       -                        }
       -                    }
       -                }
       -                Err(err) => return Err(anyhow::anyhow!("Invalid input: {err}")),
       -            },
       -            PaletteFormat::Txt => match String::from_utf8(bytes.to_vec()) {
       -                Ok(data) => {
       -                    let color_regex = Regex::new(
       -                        r"([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})",
       -                    )?;
       -                    let name_regex = Regex::new(r"\s*;Palette Name:\s*(.*)\s*")?;
       -                    let description_regex = Regex::new(r"\s*;Description:\s*(.*)\s*")?;
       -                    for line in data.lines() {
       -                        if line.starts_with(';') {
       -                            if let Some(cap) = name_regex.captures(line) {
       -                                if let Some(name) = cap.get(1) {
       -                                    title = name.as_str().to_string();
       -                                }
       -                            }
       -                            if let Some(cap) = description_regex.captures(line) {
       -                                if let Some(name) = cap.get(1) {
       -                                    description = name.as_str().to_string();
       -                                }
       -                            }
       -                        } else if let Some(cap) = color_regex.captures(line) {
       -                            let (_, [_a, r, g, b]) = cap.extract();
       -
       -                            let r = u32::from_str_radix(r, 16).unwrap();
       -                            let g = u32::from_str_radix(g, 16).unwrap();
       -                            let b = u32::from_str_radix(b, 16).unwrap();
       -                            colors.push(IceColor::from_rgb(r as u8, g as u8, b as u8));
       -                        }
       -                    }
       -                }
       -                Err(err) => return Err(anyhow::anyhow!("Invalid input: {err}")),
       -            },
       -            PaletteFormat::Ase => todo!(),
       -        }
       -        Ok(Self {
       -            title,
       -            description,
       -            colors,
       -        })
       -    }
       -}
       -
       -#[cfg(test)]
       -mod tests {
       -    use crate::{IcePalette, PaletteFormat};
       -
       -    #[test]
       -    fn test_hex_format() {
       -        let palette =
       -            IcePalette::load_palette(PaletteFormat::Hex, include_bytes!("ansi32.hex")).unwrap();
       -        assert_eq!(32, palette.len());
       -    }
       -
       -    #[test]
       -    fn test_txt_format() {
       -        let palette_hex =
       -            IcePalette::load_palette(PaletteFormat::Hex, include_bytes!("ansi32.hex")).unwrap();
       -        let palette =
       -            IcePalette::load_palette(PaletteFormat::Txt, include_bytes!("ansi32.txt")).unwrap();
       -        assert_eq!("ANSI32", palette.title);
       -        assert_eq!("All 16 original EGA ANSI art colors and 16 more in-between. I averaged these to find 8 darker and 8 lighter colors to complement the originals.", palette.description);
       -        assert_eq!(palette_hex.colors, palette.colors);
       -    }
       -
       -    #[test]
       -    fn test_pal_format() {
       -        let palette_hex =
       -            IcePalette::load_palette(PaletteFormat::Hex, include_bytes!("ansi32.hex")).unwrap();
       -        let palette =
       -            IcePalette::load_palette(PaletteFormat::Pal, include_bytes!("ansi32.pal")).unwrap();
       -        assert_eq!(palette_hex, palette);
       -    }
       -
       -    #[test]
       -    fn test_gpl_format() {
       -        let palette_hex =
       -            IcePalette::load_palette(PaletteFormat::Hex, include_bytes!("ansi32.hex")).unwrap();
       -        let palette =
       -            IcePalette::load_palette(PaletteFormat::Gpl, include_bytes!("ansi32.gpl")).unwrap();
       -        assert_eq!("ANSI32", palette.title);
       -        assert_eq!("All 16 original EGA ANSI art colors and 16 more in-between. I averaged these to find 8 darker and 8 lighter colors to complement the originals.", palette.description);
       -        assert_eq!(palette_hex.colors, palette.colors);
       -    }
       -}
 (DIR) diff --git a/src/ui/palette_editor.rs b/src/ui/palette_editor.rs
       @@ -1,8 +1,7 @@
       -use crate::{Message, Settings, SWAP_SVG};
       -use eframe::egui::{self, color_picker, Sense, TextEdit, TextStyle, Ui};
       +use crate::{Message, SWAP_SVG};
       +use eframe::egui::{self, Sense,  TextStyle, Ui};
        use eframe::emath::Align2;
        use eframe::epaint::{Color32, FontId, Pos2, Rect, Rounding, Stroke, Vec2};
       -use i18n_embed_fl::fl;
        use icy_engine::{BufferType, Palette, TextAttribute, XTERM_256_PALETTE};
        use std::cmp::min;
        
       @@ -364,7 +363,7 @@ pub fn show_extended_palette(ui: &mut Ui) -> Option<Message> {
                });
            result
        }
       -
       +/* 
        static mut CUR_COLOR: [u8; 3] = [0xFF, 0xFF, 0xFF];
        static mut RENAME_INDEX: Option<usize> = None;
        static mut EDIT_INDEX: Option<usize> = None;
       @@ -576,3 +575,4 @@ pub fn show_custom_palette(ui: &mut egui::Ui) -> Option<Message> {
                });
            result
        }
       +*/
       +\ No newline at end of file
 (DIR) diff --git a/src/ui/settings.rs b/src/ui/settings.rs
       @@ -7,7 +7,7 @@ use std::{
            path::{Path, PathBuf},
        };
        
       -use crate::{IcePalette, TerminalResult};
       +use crate::TerminalResult;
        
        const MAX_RECENT_FILES: usize = 10;
        
       @@ -16,8 +16,6 @@ pub struct Settings {
            font_outline_style: usize,
            character_set: usize,
        
       -    custom_palette: IcePalette,
       -
            recent_files: Vec<PathBuf>,
        }
        
       @@ -42,16 +40,6 @@ impl Settings {
                unsafe { SETTINGS.font_outline_style }
            }
        
       -    pub fn get_custom_palette() -> &'static mut IcePalette {
       -        unsafe { &mut SETTINGS.custom_palette }
       -    }
       -
       -    pub fn set_custom_palette(pal: IcePalette) {
       -        unsafe {
       -            SETTINGS.custom_palette = pal;
       -        }
       -    }
       -
            pub fn add_recent_file(file: &Path) {
                unsafe {
                    if !file.exists() {
       @@ -175,11 +163,6 @@ impl Settings {
        
        pub static mut SETTINGS: Settings = Settings {
            font_outline_style: 0,
       -    custom_palette: IcePalette {
       -        title: String::new(),
       -        description: String::new(),
       -        colors: Vec::new(),
       -    },
            character_set: 5,
            recent_files: Vec::new(),
        };