if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
document.documentElement.classList.add(
'ghostkit-effects-enabled'
);
}
Privately Shared
function getAverageRGB(imgEl) {
const blockSize = 5;
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
const width = canvas.width = imgEl.naturalWidth || imgEl.offsetWidth || imgEl.width;
const height = canvas.height = imgEl.naturalHeight || imgEl.offsetHeight || imgEl.height;
context.drawImage(imgEl, 0, 0, width, height);
let data, length;
let i = -4, count = 0;
try {
data = context.getImageData(0, 0, width, height).data;
length = data.length;
} catch(e) {
console.error('Error: ', e);
return {r: 0, g: 0, b: 0};
}
let r = 0, g = 0, b = 0;
while ((i += blockSize * 4) < length) {
++count;
r += data[i];
g += data[i+1];
b += data[i+2];
}
r = Math.floor(r/count);
g = Math.floor(g/count);
b = Math.floor(b/count);
return {r, g, b};
}
function isDark(r, g, b) {
const brightness = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
return brightness < 0.5;
}
function adjustClass(coverDiv) {
const img = coverDiv.querySelector('.wp-block-cover__image-background');
img.crossOrigin = "Anonymous";
img.onload = function() {
const {r, g, b} = getAverageRGB(img);
const isDarkImage = isDark(r, g, b);
if (isDarkImage) {
coverDiv.classList.add('dark-project-card');
coverDiv.classList.remove('light-project-card');
} else {
coverDiv.classList.add('light-project-card');
coverDiv.classList.remove('dark-project-card');
}
};
// Trigger onload in case the image is already loaded
if (img.complete) {
img.onload();
}
}
function adjustAllCards() {
const coverDivs = document.querySelectorAll('.wp-block-cover.project-card');
coverDivs.forEach(adjustClass);
}
// Call the function when the page loads
window.addEventListener('load', adjustAllCards);
( function() {
var skipLinkTarget = document.querySelector( 'main' ),
sibling,
skipLinkTargetID,
skipLink;
// Early exit if a skip-link target can't be located.
if ( ! skipLinkTarget ) {
return;
}
/*
* Get the site wrapper.
* The skip-link will be injected in the beginning of it.
*/
sibling = document.querySelector( '.wp-site-blocks' );
// Early exit if the root element was not found.
if ( ! sibling ) {
return;
}
// Get the skip-link target's ID, and generate one if it doesn't exist.
skipLinkTargetID = skipLinkTarget.id;
if ( ! skipLinkTargetID ) {
skipLinkTargetID = 'wp--skip-link--target';
skipLinkTarget.id = skipLinkTargetID;
}
// Create the skip link.
skipLink = document.createElement( 'a' );
skipLink.classList.add( 'skip-link', 'screen-reader-text' );
skipLink.id = 'wp-skip-link';
skipLink.href = '#' + skipLinkTargetID;
skipLink.innerText = 'Skip to content';
// Inject the skip link.
sibling.parentElement.insertBefore( skipLink, sibling );
}() );
var ghostkitVariables = {"version":"3.4.1","pro":"","themeName":"Hodessy 2025","settings":[],"disabledBlocks":[],"media_sizes":{"sm":576,"md":768,"lg":992,"xl":1200},"timezone":"Africa\/Lagos","googleMapsAPIKey":"","googleMapsAPIUrl":"https:\/\/maps.googleapis.com\/maps\/api\/js?v=3.exp&language=en","googleReCaptchaAPISiteKey":"","googleReCaptchaAPISecretKey":"","sidebars":[],"icons":[],"shapes":[],"fonts":[],"customTypographyList":[],"admin_url":"https:\/\/hodessy.com\/wp-admin\/","admin_templates_url":"https:\/\/hodessy.com\/wp-admin\/edit.php?post_type=ghostkit_template"};
if (ghostkitVariables) { ghostkitVariables.allowPluginColorPalette = false; }
if (ghostkitVariables) { ghostkitVariables.allowPluginCustomizer = false; }