Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lunamoth/713fc08a40d4f4dd65174129db54210c to your computer and use it in GitHub Desktop.
Save lunamoth/713fc08a40d4f4dd65174129db54210c to your computer and use it in GitHub Desktop.
// 제미나이 업데이트 됐다고 해서 "현재 보고 있는 웹페이지를 다크모드로 보여주는 유저스크립트를 만들어줘" 라고 테스트해봤는데, 클로드, ChatGPT, 제미나이 순이긴하군요. 아래 결과 코드 참고
// 구글 제미나이 (무료, Gemini 1.5 Pro)
// ==UserScript==
// @name Dark Mode
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Changes the page to dark mode.
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 모든 요소를 선택하여 배경색을 검은색으로 변경
document.body.style.backgroundColor = 'black';
document.body.style.color = 'white';
})();
// ChatGPT (무료, GPT-4o)
// ==UserScript==
// @name Dark Mode Toggle
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Toggle dark mode on any webpage
// @author ChatGPT
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Create a button to toggle dark mode
let button = document.createElement("button");
button.innerHTML = "Dark Mode";
button.style.position = "fixed";
button.style.bottom = "10px";
button.style.right = "10px";
button.style.zIndex = 10000;
button.style.padding = "10px";
button.style.backgroundColor = "#000";
button.style.color = "#fff";
button.style.border = "none";
button.style.borderRadius = "5px";
document.body.appendChild(button);
let darkModeEnabled = false;
button.addEventListener("click", () => {
darkModeEnabled = !darkModeEnabled;
if (darkModeEnabled) {
applyDarkMode();
} else {
removeDarkMode();
}
});
function applyDarkMode() {
document.documentElement.style.filter = "invert(1) hue-rotate(180deg)";
document.querySelectorAll("img, video").forEach((element) => {
element.style.filter = "invert(1) hue-rotate(180deg)";
});
}
function removeDarkMode() {
document.documentElement.style.filter = "";
document.querySelectorAll("img, video").forEach((element) => {
element.style.filter = "";
});
}
})();
// Claude (무료, Claude 3.5 Sonnet)
// ==UserScript==
// @name Dark Mode Converter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Convert any webpage to dark mode
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 다크모드 스타일 생성
const style = document.createElement('style');
style.textContent = `
body, body * {
background-color: #1a1a1a !important;
color: #e0e0e0 !important;
border-color: #444 !important;
}
a {
color: #3391ff !important;
}
img, video {
filter: brightness(.8) contrast(1.2);
}
`;
// 스타일을 페이지에 적용
document.head.appendChild(style);
// 토글 버튼 생성
const button = document.createElement('button');
button.textContent = '다크모드 토글';
button.style.cssText = `
position: fixed;
top: 10px;
right: 10px;
z-index: 9999;
padding: 5px 10px;
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
`;
// 토글 기능 추가
let isDarkMode = true;
button.onclick = function() {
if (isDarkMode) {
style.disabled = true;
isDarkMode = false;
} else {
style.disabled = false;
isDarkMode = true;
}
};
// 버튼을 페이지에 추가
document.body.appendChild(button);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment