Skip to content

Dark Theme Example #36

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

Merged
merged 6 commits into from
Jul 1, 2020
Merged
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
186 changes: 186 additions & 0 deletions example/dark-theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
body {
background: #3A3B46;
color: #F8F8F2;
font-family: Arial, serif;
font-size: 12px;
}

pre {
width: 100%;
overflow: auto;
}

a, a:visited {
color: #F8F8F2;
}

/*
* HTML Renderers - General
*/

.Differences {
width: 100%;
border-collapse: collapse;
border-spacing: 0;
empty-cells: show;
}

.Differences thead th {
text-align: left;
border-bottom: 1px solid #000000;
background: #AAAAAA;
color: #000000;
padding: 4px;
}

.Differences tbody th {
text-align: right;
background: #AAAAAA;
color: #272822;
width: 4em;
padding: 1px 2px;
border-right: 1px solid #000000;
vertical-align: top;
font-size: 13px;
}

.Differences td {
padding: 1px 2px;
font-family: Consolas, monospace;
font-size: 13px;
}

.Differences .Skipped {
background: #F7F7F7;
}

/*
* HTML Side by Side Diff
*/
.DifferencesSideBySide .ChangeInsert td.Left {
background: green;
}

.DifferencesSideBySide .ChangeInsert td.Right {
background: green;
}

.DifferencesSideBySide .ChangeDelete td.Left {
background: #FF8888;
color: #272822;
}

.DifferencesSideBySide .ChangeDelete td.Right {
background: #FFAAAA;
color: #272822;
}

.DifferencesSideBySide .ChangeReplace .Left {
background: #FFEE99;
color: #272822;
}

.DifferencesSideBySide .ChangeReplace .Right {
background: #FFDD88;
color: #272822;
}

.Differences ins,
.Differences del {
text-decoration: none;
}

.DifferencesSideBySide .ChangeReplace ins,
.DifferencesSideBySide .ChangeReplace del {
background: #EEBB00;
}

/*
* HTML Inline Diff
*/

.DifferencesInline .ChangeReplace {
color: #272822;
}

.DifferencesInline .ChangeReplace .Left,
.DifferencesInline .ChangeDelete .Left {
background: #FFDDDD;
color: #272822;
}

.DifferencesInline .ChangeReplace .Right,
.DifferencesInline .ChangeInsert .Right {
background: #DDFFDD;
}

.DifferencesInline .ChangeReplace ins {
background: green;
}

.DifferencesInline .ChangeReplace del {
background: #EE9999;
color: #272822;
}

/*
* HTML Unified Diff
*/

/* Line removed in new */
.DifferencesUnified .ChangeDelete .Left::before {
content: "- \00a0";
}

.DifferencesUnified .ChangeDelete .Left {
background: #EE9999;
color: #272822;
}

/* Line modified in old and new */
.DifferencesUnified .ChangeReplace {
background: #FFEE99;
color: #272822;
display: table;
}

/* Line in old replaced by line in new */
.DifferencesUnified .ChangeReplace .Left:first-child:before {
content: "\250C \00a0";
}

.DifferencesUnified .ChangeReplace .Left:before {
content: "\251C \00a0";
}

.DifferencesUnified .ChangeReplace .Left {
background: #FFEE99;
}

/* Line in new replaced line in old */
.DifferencesUnified .ChangeReplace .Right:last-of-type:before {
content: "\2514 \00a0";
}

.DifferencesUnified .ChangeReplace .Right:before {
content: "\251C \00a0";
}

.DifferencesUnified .ChangeReplace .Right {
background: #FFEE99;
}

/* Line inserted in new */
.DifferencesUnified .ChangeInsert .Right:before {
content: "+ \00A0";
}

/* Character inserted in line of new */
.DifferencesUnified .ChangeReplace ins {
background: #99EE99;
}

/* Character removed from line in old */
.DifferencesUnified .ChangeReplace del {
background: #EE9999;
}
20 changes: 19 additions & 1 deletion example/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,28 @@
<head>
<meta charset="utf-8"/>
<title>PHP LibDiff - Examples</title>
<link rel="stylesheet" href="styles.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="styles.css" />
<script>
function changeCSS(cssFile, cssLinkIndex) {

var oldLink = document.getElementsByTagName("link").item(cssLinkIndex);

var newLink = document.createElement("link");
newLink.setAttribute("rel", "stylesheet");
newLink.setAttribute("type", "text/css");
newLink.setAttribute("href", cssFile);

document.getElementsByTagName("head").item(0).replaceChild(newLink, oldLink);
}
</script>
</head>
<body>
<h1>PHP LibDiff - Examples</h1>
<aside>
<h2>Change Theme</h2>
<a href="#" onclick="changeCSS('styles.css', 0);">Light Theme</a>
<a href="#" onclick="changeCSS('dark-theme.css', 0);">Dark Theme</a>
</aside>
<hr />

<h2>HTML Side by Side Diff</h2>
Expand Down
2 changes: 1 addition & 1 deletion lib/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @author Mario Brandt <[email protected]>
* @copyright (c) 2015 Mario Brandt
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
* @version 1.17
* @version 1.18
* @link https://github.com/JBlond/php-diff
*/
class Autoloader
Expand Down
3 changes: 2 additions & 1 deletion lib/jblond/Diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
*
* @package jblond
* @author Chris Boulton <[email protected]>
* @author Mario Brandt <[email protected]>
* @author Ferry Cools <[email protected]>
* @copyright (c) 2009 Chris Boulton
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
* @version 1.17
* @version 1.18
* @link https://github.com/JBlond/php-diff
*/
class Diff
Expand Down
3 changes: 2 additions & 1 deletion lib/jblond/Diff/Renderer/Html/HtmlArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
*
* @package jblond\Diff\Renderer\Html
* @author Chris Boulton <[email protected]>
* @author Mario Brandt <[email protected]>
* @author Ferry Cools <[email protected]>
* @copyright (c) 2009 Chris Boulton
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
* @version 1.17
* @version 1.18
* @link https://github.com/JBlond/php-diff
*/
class HtmlArray extends RendererAbstract
Expand Down
3 changes: 2 additions & 1 deletion lib/jblond/Diff/Renderer/Html/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
*
* @package jblond\Diff\Renderer\Html
* @author Chris Boulton <[email protected]>
* @author Mario Brandt <[email protected]>
* @author Ferry Cools <[email protected]>
* @copyright (c) 2009 Chris Boulton
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
* @version 1.17
* @version 1.18
* @link https://github.com/JBlond/php-diff
*/
class Inline extends HtmlArray
Expand Down
3 changes: 2 additions & 1 deletion lib/jblond/Diff/Renderer/Html/SideBySide.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
*
* @package jblond\Diff\Renderer\Html
* @author Chris Boulton <[email protected]>
* @author Mario Brandt <[email protected]>
* @author Ferry Cools <[email protected]>
* @copyright (c) 2009 Chris Boulton
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
* @version 1.17
* @version 1.18
* @link https://github.com/JBlond/php-diff
*/
class SideBySide extends HtmlArray
Expand Down
3 changes: 2 additions & 1 deletion lib/jblond/Diff/Renderer/Html/Unified.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
* PHP version 7.2 or greater
*
* @package jblond\Diff\Renderer\Html
* @author Mario Brandt <[email protected]>
* @author Ferry Cools <[email protected]>
* @copyright (c) 2009 Chris Boulton
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
* @version 1.17
* @version 1.18
* @link https://github.com/JBlond/php-diff
*/
class Unified extends HtmlArray
Expand Down
3 changes: 2 additions & 1 deletion lib/jblond/Diff/Renderer/RendererAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
*
* @package jblond\Diff\Renderer
* @author Chris Boulton <[email protected]>
* @author Mario Brandt <[email protected]>
* @author Ferry Cools <[email protected]>
* @copyright (c) 2009 Chris Boulton
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
* @version 1.17
* @version 1.18
* @link https://github.com/JBlond/php-diff
*/
abstract class RendererAbstract
Expand Down
3 changes: 2 additions & 1 deletion lib/jblond/Diff/Renderer/Text/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
*
* @package jblond\Diff\Renderer\Text
* @author Chris Boulton <[email protected]>
* @author Mario Brandt <[email protected]>
* @author Ferry Cools <[email protected]>
* @copyright (c) 2009 Chris Boulton
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
* @version 1.17
* @version 1.18
* @link https://github.com/JBlond/php-diff
*/
class Context extends RendererAbstract
Expand Down
3 changes: 2 additions & 1 deletion lib/jblond/Diff/Renderer/Text/Unified.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
*
* @package jblond\Diff\Renderer\Text
* @author Chris Boulton <[email protected]>
* @author Mario Brandt <[email protected]>
* @copyright (c) 2009 Chris Boulton
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
* @version 1.17
* @version 1.18
* @link https://github.com/JBlond/php-diff
*/

Expand Down
Loading