-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Added dark mode button #2980
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
base: master
Are you sure you want to change the base?
Added dark mode button #2980
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,32 @@ | |
|
||
<link rel="canonical" href="https://underscorejs.org/" /> | ||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> | ||
<script src= | ||
"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"> | ||
</script> | ||
Comment on lines
+10
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting seems off here |
||
<title>Underscore.js</title> | ||
<style> | ||
|
||
.change { | ||
cursor: pointer; | ||
border: 1px solid #555; | ||
border-radius: 40%; | ||
width: 20px; | ||
text-align: center; | ||
padding: 5px; | ||
margin-left: 8px; | ||
|
||
} | ||
Comment on lines
+16
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another lint issue |
||
.dark{ | ||
background-color: #000000; | ||
color: white; | ||
Comment on lines
+27
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hard white on deep black is considered uncomfortable for the eyes. |
||
} | ||
body { | ||
background: #fff; | ||
/* color: #c6c6c6; */ | ||
font-size: 14px; | ||
line-height: 22px; | ||
background: #f4f4f4 url(docs/images/background.png); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to remove the background in light mode. |
||
color: #000; | ||
color: black; | ||
font-family: Helvetica Neue, Helvetica, Arial; | ||
} | ||
.interface { | ||
|
@@ -143,7 +162,7 @@ | |
} | ||
tt { | ||
padding: 0px 3px; | ||
background: #fff; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preferably replace the background color in dark mode, rather than removing it in both modes. |
||
|
||
border: 1px solid #ddd; | ||
zoom: 1; | ||
} | ||
|
@@ -259,9 +278,33 @@ | |
width: 100%; | ||
} | ||
} | ||
.mode { | ||
float:right; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<!-- <div class="mode"> | ||
Dark mode: | ||
<span class="change">OFF</span> | ||
</div> --> | ||
Comment on lines
+287
to
+290
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like you forgot to remove an outcomment here. |
||
<div class="mode"> | ||
<span class="change">OFF</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the button just says "ON"/"OFF", it is rather mysterious what it will do. For the color mode, this not too unproblematic because it is non-essential, but more people will be able to find the feature if you make it more self-describing. |
||
</div> | ||
|
||
|
||
<script> | ||
$( ".change" ).on("click", function() { | ||
if( $( "body" ).hasClass( "dark" )) { | ||
$( "body" ).removeClass( "dark" ); | ||
$( ".change" ).text( "OFF" ); | ||
} else { | ||
$( "body" ).addClass( "dark" ); | ||
$( ".change" ).text( "ON" ); | ||
} | ||
}); | ||
Comment on lines
+297
to
+305
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kudos on making this work! |
||
</script> | ||
<!-- <button onclick="myFunction()">Switch mode</button> --> | ||
|
||
<input type="checkbox" id="menu" checked> | ||
<label for="menu" role="navigation" aria-label="Menu"></label> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip: try to avoid pure whitespace changes in your next few pull requests.