(in-package #:nyxt-user)

;; This automatically darkens WebKit-native interfaces and sends the
;; "prefers-color-scheme: dark" to all the supporting websites.
(setf (uiop:getenv "GTK_THEME") "Adwaita:dark")

;; badger colorscheme, from doom-themes
(defvar badger-bg "#171717")
(defvar badger-bg-alt "#2f2f2f")
(defvar badger-base-01 "#1D1D1D")
(defvar badger-base-04 "#433F4f")
(defvar badger-fg "#F6F3E8")
(defvar badger-red "#E2434C")
(defvar badger-orange "#EA9847")
(defvar badger-green "#86B187")
(defvar badger-teal "#65A399")
(defvar badger-yellow "#E0D063")
(defvar badger-blue "#8AC6F2")
(defvar badger-magenta "#E18Cbb")
(defvar badger-violet "#BF93C3")
(defvar badger-dark-cyan "#5699AF")
(defvar badger-dark-violet "#635770")
(defvar badger-olive "#9AA68E")
(defvar badger-dull-red "#A55662")


(defvar old-hope-red "#ea3d54")
(defvar old-hope-bg "#1c1d20")
(defvar old-hope-bg-alt "#151619")

(defvar monokai-dark-blue "#727280")
(defvar monokai-orange "#FD971F")

(defvar gruvbox-red "#fb4934")
(defvar gruvbox-orange "#fe8019")

(defvar bg-magenta-intense "#7030af")
(defvar bg-red-subtle "#620f2a")
(defvar bg-green-subtle "#00422a")
(defvar bg-yellow-nuanced "#381d0f")
(defvar lavendar-bg "#38325c")

(defvar default-dark-theme
  (make-instance 'theme:theme
                 :background-color- "#333333"
                 :background-color "#121212"
                 :background-color+ "#000000"
                 :primary-color- "#d7752f"
                 :primary-color "#e48d4e"
                 :primary-color+ "#efa671"
                 :secondary-color- "#9f592d"
                 :secondary-color "#844115"
                 :secondary-color+ "#683008"
                 :action-color- "#763df2"
                 :action-color "#571fd2"
                 :action-color+ "#481fa2"
                 :highlight-color- "#ea43dd"
                 :highlight-color "#f46de8"
                 :highlight-color+ "#fc83f2"
                 :success-color- "#05f4cd"
                 :success-color "#4cfbcf"
                 :success-color+ "#87fcdf"
                 :warning-color- "#fca904"
                 :warning-color "#fcba04"
                 :warning-color+ "#ffd152"
                 :codeblock-color- "#44355a"
                 :codeblock-color "#2e243d"
                 :codeblock-color+ "#221a2d"
                 :text-color- "#dedede"
                 :text-color "#ededed"
                 :text-color+ "#ffffff"
                 :contrast-text-color "#0c0c0d"))

(defvar thanos/dark-theme
  (make-instance 'theme:theme
		 :background-color- badger-bg-alt
		 :background-color badger-bg
		 :background-color+ gruvbox-orange

		 :primary-color- "red"
		 :primary-color badger-base-04
		 :primary-color+ "#efa671"

		 :secondary-color- "#9f592d"
		 :secondary-color badger-bg-alt
		 :secondary-color+ "#683008"

		 :action-color- gruvbox-red
		 :action-color gruvbox-red
		 :action-color+ gruvbox-red

		 :highlight-color- "#ea43dd"
		 :highlight-color badger-orange
		 :highlight-color+ "#fc83f2"

		 :success-color- "#05f4cd"
		 :success-color badger-green
		 :success-color+ "#87fcdf"

		 :warning-color- "red"
		 :warning-color badger-red
		 :warning-color+ "red"

		 :codeblock-color- "red"
		 :codeblock-color badger-bg-alt

		 :text-color- badger-fg
		 :text-color badger-fg
		 :text-color+ badger-fg

		 :contrast-text-color badger-fg

		 :font-family "Jetbrains Mono"
		 :monospace-font-family "Jetbrains Mono"))

(define-configuration browser
  ((theme thanos/dark-theme
	  :doc
	  "Covers all the semantic groups (warning-color, codeblock-color etc.)
Note that you can also define more nuanced colors, like warning-color+, so
that the interface gets even nicer. Otherwise Nyxt generates the missing colors
automatically, which should be good enough... for most cases.")))

(define-configuration nyxt/mode/style:dark-mode
  ((style
    (theme:themed-css (theme *browser*)
      ;; `(h1 :color ,monokai-dark-blue "!important")
      ;; `(h2 :color ,badger-orange "!important")
      ;; `(h3 :color ,badger-green "!important")
      ;; `(article :background-color "red" "!important"
      ;; 		:color "red" "!important")
      ;; `(header :color "red")
      `(a :background-color "#000000" "!important"
	  :background-image none "!important"
	  :color ,badger-blue "!important")
      `(* :background-color "#000000" "!important"
	  :background-image none "!important"
	  :color "#ffffff" "!important"
	  :font-family "Iosevka Aile"
	  :background-image none "!important!"))))
  :doc
  "Notice the use of theme:themed-css for convenient theme color injection.")