Ozgur's Blog

Random ramblings of personal nature

Fixing Firefox Input Boxes with Dark Themes


When you use a dark theme with KDE and Firefox, you are going to see your texts are written in white when you are writing on a white backgrounded input text. Hence you won't be able to see what you wrote.

To fix this we need to go

~/.mozilla/firefox/*.default/chrome/userContent.css

To clarify we will go to *.default folder and create the rest.

mkdir chrome
touch userContent.css

Then we will paste this to userContent.css

@namespace html "http://www.w3.org/1999/xhtml";
@namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

/************ Fixes Color of Input/Entry Boxes within Web-Pages **************/
input,
textarea,
select {
  border-width: 1px !important;
  border-radius: 2px;
  background-color: white;
  color: #333333;
}
/*
input[type="radio"],
input[type="checkbox"] {
border: 2px inset white ! important;
background-color: white ! important;
color: ThreeDFace ! important;
-moz-appearance: none !important;
}
*|*::-moz-radio {
background-color: white;
-moz-appearance: none !important;
}
*/
button,
input[type="reset"],
input[type="button"],
input[type="submit"],
input[type="radio"],
input[type="checkbox"] {
  border-width: 1px !important;
  border-radius: 2px;
  background-color: #eeeeee;
  color: #333333;
}
/*
body {
background-color: white;
color: #333333;
display: block;
margin: 8px;
-moz-appearance: none !important;
}*/

#header-search {
  -moz-appearance: none !important;
  padding-bottom: 3px !important;
  color: #F3F3F5 !important;
  background-color: #313133 !important;
  border-radius: 2px !important;
  border: 1px solid #171717 !important;
  border-top-color: #0f0f0f !important;
  transition: none !important;
  box-shadow: 0 1px rgba(255,255,255,0.15),
              inset 0 1px rgba(0,0,0,0.1) !important;
}

#header-search[focused="true"] {
  -moz-appearance: none !important;
  padding-bottom: 3px !important;
  color: #F3F3F5 !important;
  background-color: #313133 !important;
  border-radius: 2px !important;
  border: 1px solid #171717 !important;
  border-top-color: #0f0f0f !important;
  transition: none !important;
  box-shadow: 0 1px rgba(255,255,255,0.15),
              inset 0 1px #3a6cce,
              inset 0 -1px #3a6cce,
              inset 1px 0 #3a6cce,
              inset -1px 0 #3a6cce !important;
}

#header-search input,
#header-search textarea {
    -moz-appearance: none !important;
  border: none !important;
  color: #F3F3F5 !important;
  background-color: #313133 !important;
}

/************ about pages **************/
@-moz-document url("about:privatebrowsing") {

  html|body {
    background-color: #2b2b2c !important;
    color: #F3F3F5 !important;
  }

}

@-moz-document url("about:newtab") {

  :root {
    background-color: white !important;
  }

  /* SCROLLBOX */
  #newtab-scrollbox:not([page-disabled]) {
    color: #F3F3F5 !important;
    background-color: #2b2b2c !important;
  }

  /* UNDO */
  #newtab-undo-container {
    border-color: #151516 !important;
    background-color: rgba(255,255,255,.2) !important;
    color: #F3F3F5 !important;
  }

  .newtab-undo-button {
    color: #FF5317 !important;
  }

  #newtab-intro-panel h1 {
    color: #B2BDC4 !important;
  }

  /* SITES */
  .newtab-site {
    box-shadow: 0 1px 3px rgba(0,0,0,0.8) !important;
  }

  .newtab-cell:not([ignorehover]) > .newtab-site:hover,
  .newtab-site[dragged] {
    border: 1px solid rgba(0,0,0,0.1) !important;
    box-shadow: 0 0 6px 2px #4cb1ff !important;
    margin: -1px !important;
  }

  /* TITLES */
  #newtab-intro-what,
  .newtab-sponsored,
  .newtab-title {
    color: #B9B9BA !important;
  }

  .newtab-site:hover .newtab-title {
    color: #F3F3F5 !important;
  }

  /* SEARCH */
  #newtab-search-logo[active],
  #newtab-search-logo:hover {
    background-color: #444547 !important;
    border: 1px solid rgba(0, 0, 0, 0.5) !important;
  }

  #newtab-search-text {
    color: #F3F3F5 !important;
    background: #232324 padding-box !important;
    border: 1px solid #171717 !important;
    border-top-color: #0f0f0f !important;
    transition: none !important;
    box-shadow: 0 1px rgba(255,255,255,0.1),
                inset 0 1px rgba(0,0,0,0.1) !important;
  }

  #newtab-search-text:focus,
  #newtab-search-text[autofocus] {
    border-color: #3a6cce !important;
  }

  #newtab-search-submit {
    background-image: linear-gradient(to bottom,
                                        #4f5154,
                                        #353537
                                        ) !important;
    border: 1px solid #171717 !important;
    border-top-color: #0f0f0f !important;
    box-shadow: 0 1px rgba(255,255,255,0.1),
                inset 0 1px rgba(255,255,255,0.15) !important;
  }

  #newtab-search-text:focus + #newtab-search-submit,
  #newtab-search-text + #newtab-search-submit:hover,
  #newtab-search-text[autofocus] + #newtab-search-submit {
    border-color: #59b5fc #45a3e7 #3294d5 !important;
  }

  #newtab-search-text:focus + #newtab-search-submit,
  #newtab-search-text[autofocus] + #newtab-search-submit {
    background-image: linear-gradient(#4cb1ff, #1793e5) !important;
    box-shadow: 0 1px 0 hsla(0,0%,100%,.2) inset,
                0 0 0 1px hsla(0,0%,100%,.1) inset,
                0 1px 0 hsla(210,54%,20%,.03) !important;
  }

  #newtab-search-text + #newtab-search-submit:hover {
    background-image: linear-gradient(#66bdff, #0d9eff) !important;
    box-shadow: 0 1px 0 hsla(0,0%,100%,.2) inset,
                0 0 0 1px hsla(0,0%,100%,.1) inset,
                0 1px 0 hsla(210,54%,20%,.03),
                0 0 4px hsla(206,100%,20%,.2) !important;
  }

  #newtab-search-text + #newtab-search-submit:hover:active {
    box-shadow: 0 1px 1px hsla(211,79%,6%,.1) inset,
                0 0 1px hsla(211,79%,6%,.2) inset !important;
  }

  #newtab-customize-panel .panel-arrowcontent,
  #newtab-search-panel .panel-arrowcontent {
    background: #353638 !important;
  }

  .newtab-customize-panel-item:not(:last-child),
  .newtab-search-panel-engine:not(:last-child) {
    border-bottom: 1px solid rgba(0,0,0,0.1) !important;
  }

  .newtab-customize-panel-item > label,
  .newtab-search-panel-engine > label {
    color: black !important;
  }

  .searchSuggestionTable {
    background-color: #1E1E1F !important;
    border-color: #1a1a1a !important;
    box-shadow: none !important;
  }

  .searchSuggestionRow.formHistory + .searchSuggestionRow.remote > td {
    border-top: 1px solid rgba(255,255,255,0.1) !important;
  }

}

@-moz-document url("about:blank") {

  body {
    background-color: #2b2b2c;
  }

}

/*Fix unreadable treeview text*/
xul|treechildren::-moz-tree-cell-text {
  color: black !important;
}


/*Make about:config list readable*/
#configTreeBody::-moz-tree-cell-text() {
  color: black !important;
}

When we restart our browser this problem will be fixed!

Edit My previous solution made some HTML elements (Radio buttons, checkboxes) unclickably small. Vertex-theme's userContent.css solves this problem so I replaced my previous css code taken from fedoraforums with it. But I'm keeping both of these references for reference's sake.

Reference:

  • https://forums.fedoraforum.org/showthread.php?304493-gtk3-firefox-dark-theme-issue&p=1732410#post1732410
  • https://github.com/oberon-manjaro/vertex-theme