Styling
RepoWidget offers extensive styling options to ensure the widget matches
your website's design. You can customize colors, shadows, borders, and more
using the cardStyles
and textStyles
configuration
options.
Card Styling
Use the cardStyles
object to customize the appearance of
repository cards:
createRepoWidget({
username: 'github-username',
containerId: 'my-repos',
cardStyles: {
backgroundColor: '#ffffff', // Card background color
boxShadow: '5px 5px 15px #d1d1d1', // Custom shadow
borderRadius: '12px', // Rounded corners
border: '1px solid #e1e4e8', // Border
padding: '20px' // Inner spacing
}
});
Text Styling
Use the textStyles
object to customize text colors:
createRepoWidget({
username: 'github-username',
containerId: 'my-repos',
textStyles: {
titleColor: '#2d3748', // Repository name color
descriptionColor: '#4a5568', // Description text color
iconColor: '#718096' // Icon color (for stars, forks)
}
});
Hover Effects
Control the hover effect using the scaleOnHover
option:
createRepoWidget({
username: 'github-username',
containerId: 'my-repos',
scaleOnHover: 1.05, // Cards grow by 5% on hover
// Use 0 or false to disable hover effect:
// scaleOnHover: 0
});
Styling Examples
Here are some preset styling examples you can use or modify:
Neumorphic Style
createRepoWidget({
username: 'github-username',
containerId: 'my-repos',
cardStyles: {
background: 'linear-gradient(145deg, #ffffff, #f0f0f0)',
boxShadow: '5px 5px 15px #d1d1d1, -5px -5px 15px #ffffff',
borderRadius: '16px',
border: 'none'
},
textStyles: {
titleColor: '#2d3748',
descriptionColor: '#4a5568',
iconColor: '#718096'
}
});
Flat Design
createRepoWidget({
username: 'github-username',
containerId: 'my-repos',
cardStyles: {
backgroundColor: '#f7fafc',
boxShadow: 'none',
borderRadius: '4px',
border: '1px solid #e2e8f0'
},
textStyles: {
titleColor: '#1a202c',
descriptionColor: '#4a5568',
iconColor: '#a0aec0'
},
scaleOnHover: 0 // Disable hover effect
});
Dark Mode
createRepoWidget({
username: 'github-username',
containerId: 'my-repos',
cardStyles: {
backgroundColor: '#2d3748',
boxShadow: '0 4px 6px rgba(0,0,0,0.2)',
borderRadius: '8px',
border: '1px solid #4a5568'
},
textStyles: {
titleColor: '#f7fafc',
descriptionColor: '#e2e8f0',
iconColor: '#a0aec0'
}
});