Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

Commit

Permalink
Shadow around image for dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Triangle717 committed Sep 4, 2014
1 parent 5dcefe3 commit cac5f63
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
}

/* Slight shadow around image */
.html-skeleton-image-shadow { box-shadow: 0 0 3px #000; }
.html-skeleton-img-shadow { box-shadow: 0 0 3px #000; }
.html-skeleton-img-shadow-dark { box-shadow: 0 0 2px 1px #fff; }

/* Shift the dialog content (excluding the image) up */
.html-skeleton-content {
Expand Down
18 changes: 16 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,20 @@ define(function(require, exports, module) {
return imageDir;
}


/**
* @private
* Check if the dark theme is enabled and return
* the appropriate class name for a slight shadow
* on the image preview
* @return {string} Appropriate shadow class name
*/
function _getImageShadow() {
if ($("body").hasClass("dark")) {
return "html-skeleton-img-shadow-dark";
}
return "html-skeleton-img-shadow";
}

/**
* @private
Expand Down Expand Up @@ -345,7 +359,7 @@ define(function(require, exports, module) {
$showImgPath.html(shortImagePath);
$imgErrorText.html("<br>is not supported for previewing!");
$showImgPath.css("color", "red");
$imgPreview.removeClass("html-skeleton-image-shadow");
$imgPreview.removeClass(_getImageShadow());
$imgPreview.attr("src", skeletonLogo);
return false;

Expand All @@ -360,7 +374,7 @@ define(function(require, exports, module) {

// Position and add small shadow to container
$(".html-skeleton-image").css("position", "relative");
$imgPreview.addClass("html-skeleton-image-shadow");
$imgPreview.addClass(_getImageShadow());

// Run process to trim the path
shortImagePath = _createImageURL(imagePath);
Expand Down

0 comments on commit cac5f63

Please sign in to comment.