# CutBox.app

## Coverage Report

#### Created: 2024-03-12 03:40

    .../Source/App/Preferences/PreferencesThemePreview.swift

    Line

    Count

    Source (jump to first uncovered line)

    1

    //

    2

    //  PreferencesThemePreview.swift

    3

    //  CutBox

    4

    //

    5

    //  Created by Jason Milkins on 22/5/18.

    6

    //  Copyright © 2018-2023 ocodo. All rights reserved.

    7

    //

    8

    9

    import Cocoa

    10

    import RxSwift

    11

    12

    class PreferencesThemePreview: CutBoxBaseBox {

    13

    14

        @IBOutlet weak var topBar: CutBoxBaseBox!

    15

        @IBOutlet weak var searchCutBox: CutBoxBaseTextField!

    16

        @IBOutlet weak var footerBox: CutBoxBaseBox!

    17

        @IBOutlet weak var itemsBox: CutBoxBaseBox!

    18

    19

        @IBOutlet weak var previewBox: CutBoxBaseBox!

    20

        @IBOutlet weak var previewText: CutBoxBaseTextField!

    21

    22

        @IBOutlet weak var selectedItem: CutBoxBaseTextField!

    23

    24

        @IBOutlet weak var label1: CutBoxBaseTextField!

    25

        @IBOutlet weak var label2: CutBoxBaseTextField!

    26

        @IBOutlet weak var label3: CutBoxBaseTextField!

    27

        @IBOutlet weak var label4: CutBoxBaseTextField!

    28

        @IBOutlet weak var label5: CutBoxBaseTextField!

    29

        @IBOutlet weak var label6: CutBoxBaseTextField!

    30

    31

    49

        let prefs = CutBoxPreferencesService.shared

    32

    33

    49

        let disposeBag = DisposeBag()

    34

    35

    49

        func applyTheme() {

    36

    49

            let theme = prefs.currentTheme

    37

    49

    38

    49

            fillColor = theme.popupBackgroundColor

    39

    49

            searchCutBox.textColor = theme.searchText.textColor

    40

    49

            topBar.fillColor = theme.searchText.backgroundColor

    41

    49

            footerBox.fillColor = theme.popupBackgroundColor

    42

    49

    43

    49

            previewBox.fillColor = theme.preview.backgroundColor

    44

    49

            previewText.textColor = theme.preview.textColor

    45

    49

    46

    49

            itemsBox.fillColor = theme.clip.backgroundColor

    47

    49

            selectedItem.backgroundColor = theme.clip.highlightColor

    48

    49

            selectedItem.textColor = theme.clip.highlightTextColor

    49

    49

            label1.textColor = theme.clip.textColor

    50

    49

            label2.textColor = theme.clip.textColor

    51

    49

            label3.textColor = theme.clip.textColor

    52

    49

            label4.textColor = theme.clip.textColor

    53

    49

            label5.textColor = theme.clip.textColor

    54

    49

            label6.textColor = theme.clip.textColor

    55

    49

        }

    56

    57

    49

        override func awakeFromNib() {

    58

    49

            applyTheme()

    59

    49

    60

    5.94k

            prefs.events.bind {

    61

    5.94k

                switch $0 {

    62

    5.94k

                case .themeChanged:

    63

    0

                    self.applyTheme()

    64

    5.94k

    65

    5.94k

                case .themesReloaded:

    66

    0

                    self.applyTheme()

    67

    5.94k

    68

    5.94k

                default:

    69

    5.94k

                    break

    70

    5.94k

                }

    71

    5.94k

            }.disposed(by: disposeBag)

    72

    49

        }

    73

    }