     }
     
     
+    /// set given theme
+    private func setTheme(name: String) {
+        
+        let theme = ThemeManager.shared.setting(name: name)
+        let isBundled = ThemeManager.shared.isBundledSetting(name: name)
+        
+        // update default theme setting
+        if UserDefaults.standard[.theme] != name {
+            // do not store to UserDefautls if it's the default theme
+            if ThemeManager.shared.defaultSettingName == name {
+                UserDefaults.standard.restore(key: .theme)
+                UserDefaults.standard[.pinsThemeAppearance] = false
+            } else {
+                let isDarkTheme = ThemeManager.shared.isDark(name: name)
+                let isDarkAppearance: Bool = {
+                    switch UserDefaults.standard[.documentAppearance] {
+                        case .default: return NSAppearance.current.isDark
+                        case .light: return false
+                        case .dark: return true
+                    }
+                }()
+                UserDefaults.standard[.pinsThemeAppearance] = (isDarkTheme != isDarkAppearance)
+                UserDefaults.standard[.theme] = name
+            }
+        }
+        
+        self.themeViewController?.theme = theme
+        self.themeViewController?.isBundled = isBundled
+        self.themeViewController?.view.setAccessibilityLabel(name)
+        
+        self.isBundled = isBundled
+    }
+    
+    
     /// try to delete given theme
     private func deleteTheme(name: String) {
         

        
        self.setupFontFamilyNameAndSize()
        
        self.updateThemeSelection()
        
        // select one of cursor type radio buttons

        
        guard notification.object as? NSTableView == self.themeTableView else { return }
        
        self.setTheme(name: self.selectedThemeName)
    }
    
    
