';
\ No newline at end of file
+if ($color_mode) {
+ $enable_color_mode_transform = $params->get('enable_color_mode_transform', 0);
+ if (!$enable_color_mode_transform) {
+ echo '
';
+ }
+}
\ No newline at end of file
diff --git a/framework/library/astroid/Helper/Head.php b/framework/library/astroid/Helper/Head.php
index 08482150..90f67f70 100644
--- a/framework/library/astroid/Helper/Head.php
+++ b/framework/library/astroid/Helper/Head.php
@@ -77,7 +77,22 @@ public static function scripts()
}
$color_mode = $template->getColorMode();
if ($color_mode) {
- $wa->addInlineScript('var TEMPLATE_HASH = "'. md5($template->template).'", ASTROID_COLOR_MODE ="'.$color_mode.'";');
+ $enable_color_mode_transform = $params->get('enable_color_mode_transform', 0);
+ if ($enable_color_mode_transform) {
+ $colormode_transform_type = $params->get('colormode_transform_type', 'light_dark');
+ $astroid_colormode_transform_offset = $params->get('astroid_colormode_transform_offset', 50);
+ if ($colormode_transform_type === 'light_dark') {
+ $from = 'light';
+ $to = 'dark';
+ } else {
+ $from = 'dark';
+ $to = 'light';
+ }
+ $wa->registerAndUseScript('astroid.colortransform', 'astroid/colortransform.min.js', ['relative' => true, 'version' => 'auto'], [], ['jquery']);
+ $wa->addInlineScript('var ASTROID_COLOR_TRANSFORM = {from:"'.$from.'", to:"'.$to.'", offset:'.$astroid_colormode_transform_offset.'};');
+ } else {
+ $wa->addInlineScript('var TEMPLATE_HASH = "'. md5($template->template).'", ASTROID_COLOR_MODE ="'.$color_mode.'";');
+ }
}
}
diff --git a/framework/library/astroid/Template.php b/framework/library/astroid/Template.php
index ad5c5d50..ccca15ee 100644
--- a/framework/library/astroid/Template.php
+++ b/framework/library/astroid/Template.php
@@ -387,9 +387,15 @@ public function getColorMode() {
$color_mode_theme = '';
if ($plg_color_mode && $color_mode) {
- $app = Factory::getApplication();
- $client_color = $app->input->get('color_mode', '', 'ALNUM');
- $color_mode_theme = !empty($client_color) ? $client_color : $app->input->cookie->get('astroid-color-mode-'.md5($this->template), $color_mode_default);
+ $enable_color_mode_transform = $this->params->get('enable_color_mode_transform', 0);
+ if ($enable_color_mode_transform) {
+ $colormode_transform_type = $this->params->get('colormode_transform_type', 'light_dark');
+ $color_mode_theme = $colormode_transform_type === 'light_dark' ? 'light' : 'dark';
+ } else {
+ $app = Factory::getApplication();
+ $client_color = $app->input->get('color_mode', '', 'ALNUM');
+ $color_mode_theme = !empty($client_color) ? $client_color : $app->input->cookie->get('astroid-color-mode-'.md5($this->template), $color_mode_default);
+ }
}
return $color_mode_theme;
}
diff --git a/framework/options/basic.xml b/framework/options/basic.xml
index a75a67d6..3f395174 100644
--- a/framework/options/basic.xml
+++ b/framework/options/basic.xml
@@ -144,17 +144,24 @@
-
+
+
-
-
+
+
+
+
+
+
+
+
diff --git a/js/colortransform.js b/js/colortransform.js
new file mode 100644
index 00000000..932f8aba
--- /dev/null
+++ b/js/colortransform.js
@@ -0,0 +1,15 @@
+(function ($) {
+ window.addEventListener("load", (event) => {
+ window.onscroll = function(ev) {
+ if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight * (ASTROID_COLOR_TRANSFORM.offset/100)) {
+ if ($('html').attr('data-bs-theme') === ASTROID_COLOR_TRANSFORM.from) {
+ $('html').attr('data-bs-theme', ASTROID_COLOR_TRANSFORM.to);
+ }
+ } else {
+ if ($('html').attr('data-bs-theme') === ASTROID_COLOR_TRANSFORM.to) {
+ $('html').attr('data-bs-theme', ASTROID_COLOR_TRANSFORM.from);
+ }
+ }
+ };
+ });
+}(jQuery));
\ No newline at end of file
diff --git a/js/colortransform.min.js b/js/colortransform.min.js
new file mode 100644
index 00000000..fddabdcd
--- /dev/null
+++ b/js/colortransform.min.js
@@ -0,0 +1 @@
+(function($){window.addEventListener("load",event=>{window.onscroll=function(ev){if(window.innerHeight+window.scrollY>=document.body.scrollHeight*(ASTROID_COLOR_TRANSFORM.offset/100)){if($("html").attr("data-bs-theme")===ASTROID_COLOR_TRANSFORM.from){$("html").attr("data-bs-theme",ASTROID_COLOR_TRANSFORM.to)}}else{if($("html").attr("data-bs-theme")===ASTROID_COLOR_TRANSFORM.to){$("html").attr("data-bs-theme",ASTROID_COLOR_TRANSFORM.from)}}}})})(jQuery);
\ No newline at end of file
diff --git a/js/script.js b/js/script.js
index e933bef3..02709602 100644
--- a/js/script.js
+++ b/js/script.js
@@ -337,30 +337,4 @@
$(window).on('resize', winResize);
$(window).on('scroll', winScroll);
window.addEventListener("orientationchange", winResize);
-})(jQuery);
-
-/*
- * Add missing Mootools when Bootstrap is loaded
- * This fix creates dummy implementations for the missing Mootools functions.
- * It requires that you have jQuery loaded and if you are dealing with Mootools + jQuery is a good idea to add the call just before this javascript code.
- * This issue shouldn't affect Bootstrap 3 templates but the fix explained here should be compatible with both.
- */
-(function ($) {
- $(document).ready(function () {
- var bootstrapLoaded = (typeof $().tooltip == 'function');
- var mootoolsLoaded = (typeof MooTools != 'undefined');
- if (bootstrapLoaded && mootoolsLoaded) {
- Element.implement({
- hide: function () {
- return this;
- },
- show: function (v) {
- return this;
- },
- slide: function (v) {
- return this;
- }
- });
- }
- });
})(jQuery);
\ No newline at end of file
diff --git a/js/script.min.js b/js/script.min.js
index 5b9d3305..1477e7f5 100644
--- a/js/script.min.js
+++ b/js/script.min.js
@@ -1 +1 @@
-(function($){var lastScrollTop=0;var windowloaded=false;var initLastScrollTop=function(){var st=$(window).scrollTop();lastScrollTop=st};var isScrollDown=function(){var st=$(window).scrollTop();return st>lastScrollTop};var initMobileMenu=function(){if(!$(".astroid-mobile-menu").length){return}$(".astroid-mobile-menu").astroidMobileMenu();$(".astroid-mobile-menu").removeClass("d-none")};var initOffcanvasMenu=function(){if(!$("#astroid-offcanvas").length){return}if($("#astroid-offcanvas").find("ul.menu").length){$("#astroid-offcanvas").find("ul.menu").astroidMobileMenu()}};var initSidebarMenu=function(){if(!$(".astroid-sidebar-menu").length){return}$(".astroid-sidebar-menu .nav-item-caret").click(function(){$(this).parent().parent("li").siblings("li").children("ul").slideUp();$(this).parent().parent("li").siblings("li").children("div").children(".nav-item-caret").removeClass("open");$(this).toggleClass("open");$(this).parent().siblings("ul").slideToggle()});$(".astroid-sidebar-collapsable").click(function(){$("#astroid-header").toggleClass("expanded")})};var initDisplay=function(){setTimeout(function(){$(".d-init").removeClass("d-none")},100)};var initBackToTop=function(){$(window).scroll(function(){if($(this).scrollTop()>=200){$("#astroid-backtotop").fadeIn(200)}else{$("#astroid-backtotop").fadeOut(200)}});$("#astroid-backtotop").on("click",function(e){e.preventDefault();$("body,html").animate({scrollTop:0},500)})};var initHeader=function(){var stickyHeader=$("#astroid-sticky-header");var _header=$("header");if(!_header.length){return false}var _headerTop=_header.offset().top;var _headerHeight=_header.height();var _headerBottom=_headerTop+_headerHeight;if(!stickyHeader.length){return}var _winScroll=$(window).scrollTop();var _breakpoint=deviceBreakpoint(true);if(_breakpoint==="xl"||_breakpoint==="lg"){if(stickyHeader.hasClass("header-sticky-desktop")&&_winScroll>_headerBottom){stickyHeader.removeClass("d-none");stickyHeader.addClass("d-flex")}else if(stickyHeader.hasClass("header-stickyonscroll-desktop")&&_winScroll>_headerBottom&&!isScrollDown()){stickyHeader.removeClass("d-none");stickyHeader.addClass("d-flex")}else{stickyHeader.removeClass("d-flex");stickyHeader.addClass("d-none")}}else if(_breakpoint==="sm"||_breakpoint==="md"){if(stickyHeader.hasClass("header-static-tablet")){if(stickyHeader.hasClass("d-flex")){stickyHeader.addClass("d-none");stickyHeader.removeClass("d-flex")}return}if(stickyHeader.hasClass("header-sticky-tablet")&&_winScroll>_headerBottom){stickyHeader.removeClass("d-none");stickyHeader.addClass("d-flex")}else if(stickyHeader.hasClass("header-stickyonscroll-tablet")&&_winScroll>_headerBottom&&!isScrollDown()){stickyHeader.addClass("d-flex");stickyHeader.removeClass("d-none")}else{stickyHeader.addClass("d-none");stickyHeader.removeClass("d-flex")}}else{if(stickyHeader.hasClass("header-static-mobile")){if(stickyHeader.hasClass("d-flex")){stickyHeader.addClass("d-none");stickyHeader.removeClass("d-flex")}return}if(stickyHeader.hasClass("header-sticky-mobile")&&_winScroll>_headerBottom){stickyHeader.addClass("d-flex");stickyHeader.removeClass("d-none")}else if(stickyHeader.hasClass("header-stickyonscroll-mobile")&&_winScroll>_headerBottom&&!isScrollDown()){stickyHeader.addClass("d-flex");stickyHeader.removeClass("d-none")}else{stickyHeader.addClass("d-none");stickyHeader.removeClass("d-flex")}}};var initEmptyHeaderContent=function(){$(".header-left-section:empty").each(function(){if(!$.trim($(this).html())){$(this).prop("hidden",true)}});$(".header-center-section:empty").each(function(){if(!$.trim($(this).html())){$(this).prop("hidden",true)}});$(".header-right-section:empty").each(function(){if(!$.trim($(this).html())){$(this).prop("hidden",true)}})};var initTooltip=function(){if($('[data-toggle="tooltip"]').length){var tooltipTriggerList=[].slice.call(document.querySelectorAll('[data-toggle="tooltip"]'));var tooltipList=tooltipTriggerList.map(function(tooltipTriggerEl){return new bootstrap.Tooltip(tooltipTriggerEl)})}};var initAnimations=function(){var bindAnimation=function(){$("[data-animation]").each(function(){var _animation=$(this).data("animation");var _delay=$(this).data("animation-delay");var _duration=$(this).data("animation-duration");if(_animation!=""&&elementInViewport($(this))&&!$(this).hasClass("animation-done")){if(_delay!=""&&_delay!=0&&_delay!="0"&&_delay!=undefined){_delay=parseInt(_delay)}else{_delay=0}if(_duration!=""&&_duration!=0&&_duration!="0"&&_duration!=undefined){_duration=parseInt(_duration)+10}else{_duration=1010}var _this=this;$(_this).css("animation-duration",_duration+"ms");setTimeout(function(){$(_this).css("visibility","visible");$(_this).addClass("animate");$(_this).addClass(_animation);$(_this).addClass("animation-done");setTimeout(function(){$(_this).removeClass("animate");$(_this).addClass("animated");$(_this).removeClass(_animation)},_duration+_delay)},_delay)}})};$(window).on("scroll",function(){bindAnimation()});bindAnimation()};var initProgressBar=function(){$(".progress-bar-viewport-animation").each(function(){var _this=$(this);if(!_this.hasClass("viewport-animation-done")&&elementInViewport(_this)){var _width=_this.data("value");_width=parseInt(_width);_this.css("width",_width+"%")}})};var elementInViewport=function(element){var _this=element;var _this_top=_this.offset().top;return _this_top<=window.pageYOffset+parseInt(window.innerHeight)&&_this_top>=window.pageYOffset};var deviceBreakpoint=function(_return){if($(".astroid-breakpoints").length==0){var _breakpoints='
';$("body").append(_breakpoints)}var _sizes=["xs","sm","md","lg","xl"];var _device="undefined";_sizes.forEach(function(_size){var _visiblity=$(".astroid-breakpoints .device-"+_size).css("display");if(_visiblity=="block"){_device=_size;return false}});if(_return){return _device}else{$("body").removeClass("astroid-device-xs").removeClass("astroid-device-sm").removeClass("astroid-device-md").removeClass("astroid-device-lg").removeClass("astroid-device-xl");$("body").addClass("astroid-device-"+_device)}};var initPreloader=function(){$("#astroid-preloader").removeClass("d-flex").addClass("d-none")};var setCookie=function(name,value,days){if(days){var date=new Date;date.setTime(date.getTime()+days*24*60*60*1e3);var expires="; expires="+date.toGMTString()}else var expires="";document.cookie=name+"="+value+expires+"; path=/"};var initColorMode=function(){if($(".astroid-color-mode").length){var switcher=$(".astroid-color-mode .switcher"),color_mode="light";if(ASTROID_COLOR_MODE==="auto"){var cur_hour=(new Date).getHours();if(24-cur_hour<7||cur_hour<6){color_mode="dark"}if(color_mode==="dark"){switcher.prop("checked",true)}else{switcher.prop("checked",false)}}else{color_mode=ASTROID_COLOR_MODE}$("html").attr("data-bs-theme",color_mode);switcher.on("change",function(){if(this.checked){switcher.each(function(i,el){if(!this.checked){$(el).prop("checked",true)}});$("html").attr("data-bs-theme","dark");setCookie("astroid-color-mode-"+TEMPLATE_HASH,"dark",3)}else{switcher.each(function(i,el){if(this.checked){$(el).prop("checked",false)}});$("html").attr("data-bs-theme","light");setCookie("astroid-color-mode-"+TEMPLATE_HASH,"light",3)}})}};var docReady=function(){initDisplay();initMobileMenu();initOffcanvasMenu();initSidebarMenu();initColorMode();initBackToTop();initHeader();initEmptyHeaderContent();initTooltip();deviceBreakpoint(false)};var winLoad=function(){initAnimations();deviceBreakpoint(false);initPreloader();initProgressBar();windowloaded=true};var winResize=function(){deviceBreakpoint(false);initHeader()};var winScroll=function(){initHeader();initLastScrollTop();if(windowloaded){initProgressBar()}deviceBreakpoint(false)};$(docReady);$(window).on("load",winLoad);$(window).on("resize",winResize);$(window).on("scroll",winScroll);window.addEventListener("orientationchange",winResize)})(jQuery);
\ No newline at end of file
diff --git a/language/en-GB/en-GB.astroid.ini b/language/en-GB/en-GB.astroid.ini
index c5453f40..8e8de150 100644
--- a/language/en-GB/en-GB.astroid.ini
+++ b/language/en-GB/en-GB.astroid.ini
@@ -210,6 +210,14 @@ TPL_ASTROID_OPEN_GRAPH_TITLE_LABEL="Open Graph"
TPL_ASTROID_PAGE_SETTING_MAIN_TITLE_LABEL="Page Settings"
TPL_ASTROID_BASIC_ENABLE_COLOR_MODE_LABEL="Color Mode"
ASTROID_BASIC_ENABLE_COLOR_MODE_DESC="Enable or disable the color mode."
+TPL_ASTROID_BASIC_ENABLE_COLOR_MODE_TRANSFORM_LABEL="Enable Color Transform"
+TPL_ASTROID_BASIC_ENABLE_COLOR_MODE_TRANSFORM_DESC="Change color from light to dark or vice versa"
+TPL_ASTROID_BASIC_COLOR_MODE_TRANSFORM_TYPE_LABEL="Transform Type"
+TPL_ASTROID_BASIC_COLOR_MODE_TRANSFORM_TYPE_DESC="Change color from light to dark or vice versa. Choose one of these types"
+TPL_ASTROID_BASIC_COLOR_MODE_TRANSFORM_TYPE_LIGHT_DARK_LABEL="Light to Dark"
+TPL_ASTROID_BASIC_COLOR_MODE_TRANSFORM_TYPE_DARK_LIGHT_LABEL="Dark to Light"
+TPL_ASTROID_BASIC_COLOR_MODE_TRANSFORM_OFFSET_LABEL="Transform Offset"
+TPL_ASTROID_BASIC_COLOR_MODE_TRANSFORM_OFFSET_DESC="Vertical page offset triggers color to switch"
TPL_ASTROID_BASIC_ENABLE_WIDGETS_LABEL="Enable Widgets"
TPL_ASTROID_BASIC_ENABLE_WIDGETS_DESC="Enable or disable the Widgets"
TPL_ASTROID_BASIC_REMOVE_GENERATOR_LABEL="Remove Generator"