Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include a Dark Mode for extension UI #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stylish.safariextension/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<meta charset="UTF-8">
<title>About</title>

<link rel="stylesheet" type="text/css" href="assets/styles.css" media="all">
<script type="text/javascript" src="assets/checkDarkMode.js"></script>
<script type="text/javascript" src="assets/jquery.js"></script>
<script type="text/javascript" src="assets/fn.js"></script>
<script type="text/javascript" src="assets/about.js"></script>
Expand Down
14 changes: 14 additions & 0 deletions stylish.safariextension/assets/checkDarkMode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* Quick check to see if Dark Mode is enabled, and use the appropriate CSS if so.*/
safari.self.addEventListener('message', setDarkMode, false);

safari.self.tab.dispatchMessage('getDarkMode');


function setDarkMode(msg) {
if (msg.name == 'isDarkMode') {
var isDarkMode = msg.message;
if (isDarkMode == "on")
$('head').append('<link rel="stylesheet" type="text/css" href="assets/dark-styles.css" media="all">');

}
}
67 changes: 67 additions & 0 deletions stylish.safariextension/assets/dark-buttons.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
button,
.button {
display: inline-block;
background: #0e52a5 -webkit-gradient(linear, 0 0, 0 100%, from(rgba(255,255,255,.3)), to(rgba(255,255,255,.1)));
border: 1px solid;
border-color: rgba(0,0,0,.1) rgba(0,0,0,.2) rgba(0,0,0,.5) rgba(0,0,0,.2);
box-shadow: inset 0 1px 0 0 rgba(255,255,255,.3), 0 1px 2px 0 rgba(0,0,0,.3);
border-radius: 12px;
color: rgb(210, 210, 210);
font-size: 10px;
font-weight: normal;
line-height: 1;
width: 92px;
padding: 2px 0 3px;
text-align: center;
text-shadow: 0 -1px 1px rgba(0,0,0,.1);
margin-right: .5em;
box-sizing: border-box;
transition: all .2s ease-in;
}
button.red,
.button.red {
background-color:#ac2c2c;
}

button:hover,
button.hover,
.button:hover,
.button.hover {
background-image: gradient(linear, 0 0, 0 100%, from(rgba(255,255,255,.2)), to(rgba(255,255,255,.05)));
box-shadow: inset 0 1px 0 0 rgba(255,255,255,.2);
cursor: pointer;
text-shadow: 0 -1px 1px rgba(0,0,0,.2);
text-decoration: none;
}

button:active,
.button:active {
background-image:none;
border:1px solid rgba(0,0,0,.5);
box-shadow:inset 0 0 6px 3px rgba(0,0,0,.2), 0 1px 0 0 rgb(90, 90, 90);
text-shadow:0 -1px 1px rgba(0,0,0,.4);
}

button[disabled], button.disabled,
button[disabled]:hover, button.disabled:hover,
button[disabled]:active, button.disabled:active,

.button[disabled], .button.disabled,
.button[disabled]:hover, .button.disabled:hover,
.button[disabled]:active, .button.disabled:active {
background-color:rgb(85, 85, 85);
color:rgb(40, 40, 40);
box-shadow:none;
border-color:rgba(0,0,0,.2);
box-shadow:none;
cursor:not-allowed;
text-shadow:0 1px 1px rgba(255,255,255,.5);
}

a {
color:#08C;
text-decoration:none;
}
a:hover {
text-decoration:underline;
}
Loading