             }
         }()
         
+        // create theme
+        assert(settings[.theme] != nil)
+        let themeName = (settings[.theme] as? String) ?? ThemeName.blackAndWhite
+        let theme = ThemeManager.shared.setting(name: themeName)  // nil for Black and White
+        
+        guard self.theme?.name != theme?.name else { return }
+        
         // set theme
-        assert(settings[.theme] != nil)
-        let lastThemeName = self.theme?.name
-        let themeName = (settings[.theme] as? String) ?? ThemeName.blackAndWhite
-        let theme = ThemeManager.shared.setting(name: themeName)
-        if let theme = theme {
-            self.theme = theme
-            self.textColor = theme.text.color
-            self.backgroundColor = theme.background.color
-            layoutManager.invisiblesColor = theme.invisibles.color
-            
-        } else {  // black and white
-            self.theme = nil
-            self.textColor = .textColor
-            self.backgroundColor = .textBackgroundColor
-            layoutManager.invisiblesColor = .secondaryLabelColor
-        }
-        
-        guard lastThemeName != theme?.name else { return }
+        self.theme = theme
+        self.textColor = theme?.text.color ?? .textColor
+        self.backgroundColor = theme?.background.color ?? .textBackgroundColor  // expensive task
+        layoutManager.invisiblesColor = theme?.invisibles.color ?? .disabledControlTextColor
         
         // perform syntax highlight
         weak var controller = NSPrintOperation.current?.printPanel.accessoryControllers.first as? PrintPanelAccessoryController

        self.dateFormatter = DateFormatter()
        self.dateFormatter.dateFormat = UserDefaults.standard[.headerFooterDateFormat]
        
        self.lineHeight = UserDefaults.standard[.lineHeight]
        
        // setup textContainer

        willSet {
            // set tab width
            let paragraphStyle = NSParagraphStyle.default.mutable
            
            paragraphStyle.tabStops = []
            paragraphStyle.defaultTabInterval = CGFloat(self.tabWidth) * (newValue?.spaceWidth ?? 0)
            paragraphStyle.lineHeightMultiple = self.lineHeight
            self.defaultParagraphStyle = paragraphStyle
            
