Skip to content

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

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 docs/docco.css
Copy link
Collaborator

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.

Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ ul.sections > li > div {
position: relative;
}
body {
background-color: #F5F5FF;
background-color:#F5F5FF;
font-size: 15px;
line-height: 21px;
}
Expand Down
49 changes: 46 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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

Choose a reason for hiding this comment

The 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

Choose a reason for hiding this comment

The 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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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);
Copy link
Collaborator

Choose a reason for hiding this comment

The 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 {
Expand Down Expand Up @@ -143,7 +162,7 @@
}
tt {
padding: 0px 3px;
background: #fff;
Copy link
Collaborator

Choose a reason for hiding this comment

The 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;
}
Expand Down Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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>
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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>
Expand Down