hopkir / Google Chat Dark

// ==UserScript==
// @name         Google Chat Dark
// @namespace    https://openuserjs.org/users/hopkir
// @description  Dark theme for chat.google.com
// @author       hopkir
// @copyright    2021, hopkir (https://openuserjs.org/users/hopkir)
// @homepage     https://openuserjs.org/scripts/hopkir
// @include      http://chat.google.com/*
// @include      https://chat.google.com/*
// @include      http://*.chat.google.com/*
// @include      https://*.chat.google.com/*
// @license      MIT
// @run-at       document-start
// @version      0.1.4
// @updateURL    https://openuserjs.org/meta/hopkir/Google_Chat_Dark.meta.js
// @downloadURL  https://openuserjs.org/install/hopkir/Google_Chat_Dark.user.js
// ==/UserScript==
// Adapted from Jiří Kremser's Dark Theme for Chat at https://userstyles.org/styles/166023

(function () {
  var css = [
    "div[aria-hidden], .BScnzc {",
    "    background-color: transparent !important;",
    "}",
    ".XweIZc {",
    "    background-color: transparent !important;",
    "}",
    "",
    ".BScnzc {",
    "    margin-left: 17px;",
    "    background-color: transparent !important;",
    "}",
    "",
    ".EFNTcf {",
    "    margin-right: 15px !important;",
    "}",
    "",
    "",
    "/* contact cards */",
    ".Ukpgsf {",
    "    background-color: #454545 !important;",
    "    border: 1px solid;",
    "    color: #fff !important;",
    "}",
    "",
    "",
    "/* icons on contact cards */",
    ".X5KVDc.GGZtCb,",
    ".Nj8aCb.Nj8aCb {",
    "    fill: #ccc !important;",
    "}",
    "",
    "",
    "/* popups for emojis */",
    ".AZnilc,",
    ".RM9ulf {",
    "    -webkit-transition-delay: 0s!important;",
    "    transition-delay: 0s !important;",
    "    background-color: #5e5e5e !important;",
    "    border-radius: 10px !important;",
    "}",
    "",
    ".f8lxbf {",
    "    fill: #ddd !important;",
    "}",
    "",
    "",
    "div .mUbCce:hover,",
    "div .mUbCce:focus,",
    "div .mUbCce:active,",
    "div .mUbCce.qs41qe,",
    "div .mUbCce.u3bW4e,",
    ".JRtysb:hover .snByac,",
    ".JRtysb:focus .snByac,",
    ".JRtysb:active .snByac,",
    ".JRtysb.qs41qe .snByac,",
    ".JRtysb.u3bW4e .snByac {",
    "    fill: #fff !important;",
    "}",
    "",
    "",
    "/*",
    ".AZnilc, .RM9ulf {",
    "    background-color: #fff !important;",
    "}",
    "*/",
    ".Ukpgsf * {",
    "    background-color: #454545 !important;",
    "}",
    "",
    "",
    "/* this can break if they chang the style name, it\'s there for emoji popup*/",
    "c-wiz.zZ3s4 div {",
    "    background-color: rgba(0, 0, 0, .5) !important;",
    "}",
    "",
    ".QQodff > .FvYVyf,",
    ".Bl2pUd,",
    ".IEIJqd,",
    ".A2BXPe,",
    ".nhkdZe,",
    ".cZICLc {",
    "    background-color: #454545 !important;",
    "}",
    "",
    ".nHjhsd {",
    "    fill: #fff;",
    "}",
    "",
    ".fKz7Od {",
    "    fill: #d5d5d5;",
    "}",
    "",
    "",
    ".yg4pvb:before {",
    "    background: transparent !important;",
    "}",
    "",
    ".Pgm7ld,",
    ".EvLf6c {",
    "    background-color: #444 !important;",
    "}",
    "",
    ".dJ9vNe {",
    "    border: solid 1px #838383 !important;",
    "}",
    "",
    ".FvYVyf {",
    "    color: #fff !important;",
    "}",
    "",
    ".cZICLc {",
    "    margin-top: 0px !important;",
    "    padding-top: 20px !important;",
    "}",
    "",
    "",
    "div,",
    "span {",
    "    background: transparent;",
    "    color: #ccc",
    "}",

    "div.X9KLPc,",
    ".cPjwNc.Pmly4e",
    "{",
    "    background-color: #373737;",
    "    color: #ccc",
    "}"

    //added starting here
    ,
    //page background
    "div.mfLLkf,",
    "div.dKv0S.AUFR7b,",
    "div.QTQg5e {",
    "    background-color: #555 !important;",
    "}",

    // Green online circle
    "div.dDI85b.fLKygf>div.Qgwczb {",
    "    background-color: #0f0 !important;",
    "}",
    "",
    "",

    //selected User or group
    "span.IL9EXe.PL5Wwe.dHI9xe.qs41qe,",
    "span.IL9EXe.PL5Wwe.dHI9xe.qs41qe span.njhDLd,",
    "span.IL9EXe.PL5Wwe.dHI9xe.qs41qe span.jy2fzc,",
    "span.IL9EXe.PL5Wwe.dHI9xe.qs41qe div.kjWKTd.RsRwdf {",
    "    background-color: #08a !important;",
    "    color: #ff7 !important;",
    "    font-weight: 800 !important;",
    "    text-shadow: 3px 3px 4px #000 !important;",
    "}",

    //pending unread messages
    "span.IL9EXe.PL5Wwe.dHI9xe.H7du2,",
    "span.IL9EXe.PL5Wwe.dHI9xe.H7du2 .njhDLd,",
    "span.IL9EXe.PL5Wwe.dHI9xe.H7du2 .jy2fzc,",
    "span.IL9EXe.PL5Wwe.dHI9xe.H7du2 .kjWKTd.RsRwdf {",
    "    background-color: #f20 !important;",
    "    color: #00ddff !important;",
    "    font-weight: 800 !important;",
    "    text-shadow: 3px 3px 4px #000 !important;",
    "}",
    "",
    "",

    //unselected user name
    "span.IL9EXe.PL5Wwe.dHI9xe.rcdhB.WD3P7 span.njhDLd {",
    "    color: #fff !important;",
    "    text-shadow: 3px 3px 4px #000 !important;",
    "}",

    //unselected user last message text
    "span.IL9EXe.PL5Wwe.dHI9xe.rcdhB.WD3P7 div.kjWKTd.RsRwdf {",
    "    color: #ccc !important;",
    "}",

    //Headings
    "span.wWf0Bc.ojqkvd,",
    "div.LoYJxb.a6tGsd,",
    "div.LoYJxb.C31IFb,",
    "div.aOHsTc {",
    "    color: #fff !important;",
    "    font-weight: 700 !important;",
    "}",

    //Suggested Reply Buttons
    "button.T9VbLe {",
    "    background-color: #555 !important;",
    "}",
    "",
    "",
    "button.T9VbLe div.ubzhQb {",
    "    background-color: #555 !important;",
    "    color: #fff !important;",
    "}",

    //Text Output Background
    "div.dsoUjb.McQwEc,",
    "div.nF6pT.AnmYv,",
    "div.dsoUjb.McQwEc div.oGsu4,",
    "div.nF6pT.jO0Dzb,",
    "div.dsoUjb.McQwEc div.oGsu4 div.Zc1Emd.QIJiHb.MiRdyc.siItg,",
    "div.dsoUjb.McQwEc div.oGsu4 span.njhDLd {",
    "    background-color: #555 !important;",
    "    color: #fff !important;",
    "}",

    //Cancel the White on Hover
    "div.YJxKBc.QE8tKf:hover,",
    "div.B8q9Gf.qnQFwb.hu21Y.VYsRpc {",
    "    background-color: #555 !important;",
    "}",

    //bottom background
    ".bzJiD.WQKmIb.eO2Zfd.lEX7Ob,",
    "div.XganBc.eLNT1d,",
    "div.byY7Yb.cFc9ae",
    " {",
    "    background-color: #454545 !important;",
    "}",

    //New Thread box background
    "div.vmpzOc.eO2Zfd,",
    "div.IEIJqd.qs41qe div.XganBc {",
    "    background-color: #666 !important;",
    "    color: #000 !important;",
    "    border: 1px solid #ccc;",
    "    border-radius: 10px;",
    "    margin-bottom: 10px;",
    "}",

    //Text Input Area
    "div.Kqyxvc.qBALNe div.oAzRtb.krjOGe,",
    "div.Kqyxvc div.oAzRtb.krjOGe {",
    "    color: #000 !important;",
    "}",

    //Text Input decorator
    "div.Kqyxvc.qBALNe div.Ct5IYc.qs41qe,",
    "div.Kqyxvc div.Ct5IYc.qs41qe {",
    "    color: #666 !important;",
    "}",

    //Code Window
    "div.Zc1Emd.QIJiHb.MiRdyc.siItg div.FMTudf,",
    "span.U8d2H {",
    "    color: #fff !important;",
    "    background-color: #333 !important;",
    "    border: 1px solid #fff;",
    "    border-radius: 5px;",
    "}",

    //Lighten Text
    "div.kjWKTd.RsRwdf,",
    "div.HLTcjb,",
    "div.gWTIDe,", //Active-Do not disturb selector
    "div.aqvEkc", // xxxx is typing
    "span.LrM3We.x1jjEb {",
    "    color: #ccc !important;",
    "}",

    //links
    "a {",
    "    color: #faa !important;",
    "}",

    //Tags
    "span.fWwrkf {",
    "    color: #0df !important;",
    "}",

    //Following button
    "div.zxHSSc.FuHVqe {",
    "    color: #0df !important;",
    "}",

    //Emoji divs
    "",
    "div.eWw5ab {",
    "    background-color: #333 !important;",
    "}"

    //end of added section

  ].join("\n");
  if (typeof GM_addStyle != "undefined") {
    GM_addStyle(css);
  }
  else if (typeof PRO_addStyle != "undefined") {
    PRO_addStyle(css);
  }
  else if (typeof addStyle != "undefined") {
    addStyle(css);
  }
  else {
    var node = document.createElement("style");
    node.type = "text/css";
    node.appendChild(document.createTextNode(css));
    var heads = document.getElementsByTagName("head");
    if (heads.length > 0) {
      heads[0].appendChild(node);
    }
    else {
      // no head yet, stick it whereever
      document.documentElement.appendChild(node);
    }
  }
})();