Last active
March 1, 2025 04:15
-
-
Save bert9946/27e00f4fac175630c4da0fe1f5bbd19a to your computer and use it in GitHub Desktop.
Replace the logo on the GitHub logo with a "P-hub" style one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GitHub logo replace | |
// @description Replace the logo on the GitHub logo with a "P-hub" style one. | |
// @run-at document-body | |
// @version 3.1.0 | |
// @match *://github.com/* | |
// @match *://gist.github.com/* | |
// @exclude *://training.github.com/* | |
// @exclude *://docs.github.com/* | |
// @author Bert Chen | |
// ==/UserScript== | |
(function () { | |
if (window.location.hostname === "github.com") { | |
var oldLogo = document.getElementsByClassName('octicon-mark-github')[1]; | |
var a = document.getElementsByClassName('AppHeader-logo')[1]; | |
a.setAttribute("style", "width: 86.6px; border-radius: 3px"); | |
} | |
else if (window.location.hostname === "gist.github.com") { | |
var oldLogo = document.getElementsByClassName('octicon-logo-github')[0]; | |
} | |
//"P hub" style logo | |
var img = document.createElement("img"); | |
const src_dark = "https://gist.githubusercontent.com/bert9946/27e00f4fac175630c4da0fe1f5bbd19a/raw/23d43dd3c661582a1bb8e067b61e2b14cd725eb0/Logo_dark.svg"; | |
const src_light = "https://gist.githubusercontent.com/bert9946/27e00f4fac175630c4da0fe1f5bbd19a/raw/23d43dd3c661582a1bb8e067b61e2b14cd725eb0/Logo_light.svg"; | |
if (window.location.hostname === "github.com") { | |
const updateLogo = (isDarkMode) => { | |
img.src = isDarkMode ? src_dark : src_light; | |
}; | |
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches; | |
updateLogo(isDarkMode); | |
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => { | |
updateLogo(event.matches); | |
}); | |
} | |
else { | |
img.src = src_dark; | |
} | |
img.setAttribute("style", "width: 86.6px; height: 32px;"); | |
img.classList = 'octicon octicon-logo-github octicon-mark-github v-align-middle'; | |
oldLogo.replaceWith(img); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svg width="1099" height="406" viewBox="0 0 1099 406" xmlns="http://www.w3.org/2000/svg"> | |
<path id="-" fill="#ff9000" fill-rule="evenodd" stroke="none" d="M 1068.495605 0 L 484.193268 0 C 466.014984 2.054749 456.016144 13.258667 454.24939 33.712372 L 454.24939 372.163086 C 455.998596 392.585358 465.975098 403.746063 484.032135 405.883118 L 1068.63916 405.883118 C 1086.702637 403.746063 1096.672607 392.577393 1098.425049 372.163086 L 1098.425049 33.712372 C 1096.663208 13.258667 1086.66272 2.054749 1068.495605 0 Z"/> | |
<g id="2-"> | |
<g id="g1"> | |
<g id="g2"> | |
<path id="path1" fill="#100f0f" stroke="none" d="M 685.274109 67.115082 C 685.274109 65.029449 683.621277 63.34671 681.553162 63.34671 L 636.413757 63.34671 C 634.351746 63.34671 632.675354 65.029449 632.675354 67.115082 C 632.675354 67.124634 632.687317 154.348892 632.687317 154.348892 L 562.326111 154.348892 L 562.326111 67.115082 C 562.326111 65.029449 560.665649 63.34671 558.60144 63.34671 L 513.463928 63.34671 C 511.409576 63.34671 509.735382 65.029449 509.735382 67.115082 L 509.735382 303.320709 C 509.735382 305.404236 511.409576 307.099609 513.463928 307.099609 L 558.60144 307.099609 C 560.665649 307.099609 562.326111 305.404236 562.326111 303.320709 L 562.326111 202.28685 L 632.687317 202.28685 C 632.687317 202.28685 632.564941 303.313019 632.564941 303.320709 C 632.564941 305.404236 634.239197 307.099609 636.303345 307.099609 L 681.549194 307.099609 C 683.617249 307.099609 685.270142 305.404236 685.274109 303.320709 L 685.274109 67.115082 Z"/> | |
</g> | |
<g id="g3"> | |
<path id="path2" fill="#100f0f" stroke="none" d="M 856.826172 141.053375 L 812.031921 141.053375 C 809.9776 141.053375 808.30542 142.746979 808.30542 144.830444 L 808.30542 260.648926 C 808.30542 260.648926 796.925232 268.975372 780.773132 268.975372 C 764.622864 268.975372 760.335693 261.646149 760.335693 245.831467 C 760.335693 229.997467 760.335693 144.830444 760.335693 144.830444 C 760.335693 142.746979 758.667236 141.053375 756.610779 141.053375 L 711.149353 141.053375 C 709.096924 141.053375 707.416809 142.746979 707.416809 144.830444 C 707.416809 144.830444 707.416809 206.508163 707.416809 253.478851 C 707.416809 300.453491 733.596924 311.945984 769.612549 311.945984 C 799.158386 311.945984 822.981445 295.623047 822.981445 295.623047 C 822.981445 295.623047 824.11615 304.224731 824.628418 305.244995 C 825.142273 306.261627 826.479065 307.289825 827.924194 307.289825 L 856.84552 307.161865 C 858.89801 307.161865 860.577881 305.466156 860.577881 303.390381 L 860.56427 144.830444 C 860.56427 142.746979 858.890076 141.053375 856.826172 141.053375 Z"/> | |
</g> | |
<g id="g5"> | |
<path id="path3" fill="#100f0f" stroke="none" d="M 979.254211 135.747467 C 953.81311 135.747467 936.508728 147.098267 936.508728 147.098267 L 936.508728 67.115082 C 936.508728 65.029449 934.842163 63.34671 932.783813 63.34671 L 887.516541 63.34671 C 885.457947 63.34671 883.786072 65.029449 883.786072 67.115082 L 883.786072 303.320709 C 883.786072 305.404236 885.457947 307.099609 887.5224 307.099609 C 887.526367 307.099609 918.918884 307.099609 918.92865 307.099609 C 920.342834 307.099609 921.413696 306.370178 922.205139 305.09375 C 922.985229 303.825012 924.112183 294.20282 924.112183 294.20282 C 924.112183 294.20282 942.62146 311.744141 977.663391 311.744141 C 1018.800537 311.744141 1042.3927 290.877625 1042.3927 218.070251 C 1042.3927 145.262207 1004.714417 135.747467 979.254211 135.747467 Z M 961.586792 268.831818 C 946.049377 268.358459 935.511536 261.308441 935.511536 261.308441 L 935.511536 186.506927 C 935.511536 186.506927 945.907654 180.135117 958.663086 178.995422 C 974.794067 177.551071 990.337219 182.423355 990.337219 220.902863 C 990.337219 261.479248 983.322144 269.487366 961.586792 268.831818 Z"/> | |
</g> | |
</g> | |
<g id="g6"> | |
<g id="g7"> | |
<path id="path4" fill="#000000" stroke="none" d="M 184.119293 164.426132 L 103.949883 164.426132 C 101.881752 164.426132 100.203789 166.105225 100.203789 168.174088 L 100.203789 207.369507 C 100.203789 209.437607 101.881752 211.121414 103.949883 211.121414 L 135.224304 211.121414 L 135.224304 259.818542 C 135.224304 259.818542 128.201523 262.212708 108.7883 262.212708 C 85.882736 262.212708 53.886829 253.843567 53.886829 183.483673 C 53.886829 113.109985 87.20417 103.850311 118.484177 103.850311 C 145.560379 103.850311 157.225571 108.616974 164.647797 110.915009 C 166.979736 111.628845 169.136826 109.306702 169.136826 107.237518 L 178.080231 69.366241 C 178.080231 68.397339 177.752304 67.231323 176.648575 66.439911 C 173.633804 64.289398 155.244629 54 108.7883 54 C 55.268131 54 0.370624 76.769409 0.370624 186.227737 C 0.370624 295.688995 63.224049 312 116.189301 312 C 160.044312 312 186.649063 293.259827 186.649063 293.259827 C 187.745117 292.654633 187.863495 291.12207 187.863495 290.419861 L 187.863495 168.174088 C 187.863495 166.105225 186.187393 164.426132 184.119293 164.426132 Z"/> | |
</g> | |
<g id="g9"> | |
<path id="path5" fill="#000000" stroke="none" d="M 269.299774 98.110077 C 269.299774 81.85672 256.268921 68.722321 240.190414 68.722321 C 224.12944 68.722321 211.088989 81.85672 211.088989 98.110077 C 211.088989 114.347748 224.12944 127.518158 240.190414 127.518158 C 256.268921 127.518158 269.299774 114.347748 269.299774 98.110077 Z"/> | |
<path id="path6" fill="#000000" stroke="none" d="M 266.071777 253.494217 C 266.071777 247.44165 266.071777 144.460999 266.071777 144.460999 C 266.071777 142.390961 264.401489 140.698456 262.337128 140.698456 L 217.339706 140.698456 C 215.275299 140.698456 213.428604 142.827515 213.428604 144.897491 C 213.428604 144.897491 213.428604 276.098816 213.428604 301.10907 C 213.428604 305.699036 216.290024 307.064697 219.991348 307.064697 C 219.991348 307.064697 239.197144 307.064697 260.533081 307.064697 C 264.981598 307.064697 266.071777 304.88028 266.071777 301.0354 C 266.071777 292.662323 266.071777 259.86145 266.071777 253.494217 Z"/> | |
</g> | |
<g id="g10"> | |
<path id="path7" fill="#000000" stroke="none" d="M 395.805511 140.677032 L 361.94516 140.677032 C 361.94516 140.677032 361.894836 95.953766 361.894836 95.943909 C 361.894836 94.250397 361.021851 93.404633 359.064453 93.404633 L 312.922241 93.404633 C 311.127716 93.404633 310.165466 94.194214 310.165466 95.917999 L 310.165466 142.143555 C 310.165466 142.143555 287.040863 147.726044 285.477325 148.176819 C 283.921448 148.628998 282.774872 150.064575 282.774872 151.777481 L 282.774872 180.825912 C 282.774872 182.914948 284.443268 184.600098 286.507416 184.600098 L 310.165466 184.600098 C 310.165466 184.600098 310.165466 214.981888 310.165466 254.483765 C 310.165466 306.38974 346.574951 311.488007 371.142853 311.488007 C 382.369415 311.488007 395.797852 307.883362 398.01532 307.064697 C 399.355835 306.572021 400.13562 305.183014 400.13562 303.67749 L 400.172485 271.722382 C 400.172485 269.638855 398.412933 267.951141 396.430359 267.951141 C 394.457306 267.951141 389.409424 268.754211 384.212372 268.754211 C 367.580811 268.754211 361.94516 261.021545 361.94516 251.011047 C 361.94516 241.008682 361.943329 184.600098 361.943329 184.600098 L 395.805511 184.600098 C 397.869659 184.600098 399.542084 182.914948 399.542084 180.825912 L 399.542084 144.440582 C 399.542084 142.356049 397.869659 140.677032 395.805511 140.677032 Z"/> | |
</g> | |
</g> | |
</g> | |
</svg> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment