Skip to content
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

feature: thicker desktop like outline applied #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 13 additions & 1 deletion src/HTMLVideo/HTMLVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,19 @@ function HTMLVideo(options) {
case 'subtitlesOutlineColor': {
if (typeof propValue === 'string') {
try {
styleElement.sheet.cssRules[0].style.textShadow = Color(propValue).rgb().string() + ' 1px 1px 0.1em';
var color = Color(propValue).rgb().string();
var shadows = [
color + ' 2px 0px 0',
color + ' -2px 0px 0',
color + ' 0px 2px 0',
color + ' 0px -2px 0',
color + ' 2px 2px 0',
color + ' -2px -2px 0',
color + ' 2px -2px 0',
color + ' -2px 2px 0'
];

styleElement.sheet.cssRules[0].style.textShadow = shadows.join(', ');
} catch (error) {
// eslint-disable-next-line no-console
console.error('HTMLVideo', error);
Expand Down
14 changes: 13 additions & 1 deletion src/withHTMLSubtitles/withHTMLSubtitles.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,25 @@ function withHTMLSubtitles(Video) {
}

subtitlesElement.style.bottom = offset + '%';
var color = outlineColor;
var shadows = [
color + ' 2px 0px 0',
color + ' -2px 0px 0',
color + ' 0px 2px 0',
color + ' 0px -2px 0',
color + ' 2px 2px 0',
color + ' -2px -2px 0',
color + ' 2px -2px 0',
color + ' -2px 2px 0'
];

subtitlesRenderer.render(cuesByTime, videoState.time + delay).forEach(function(cueNode) {
cueNode.style.display = 'inline-block';
cueNode.style.padding = '0.2em';
cueNode.style.fontSize = Math.floor(size / 25) + 'vmin';
cueNode.style.color = textColor;
cueNode.style.backgroundColor = backgroundColor;
cueNode.style.textShadow = '1px 1px 0.1em ' + outlineColor;
cueNode.style.textShadow = shadows.join(', ');
subtitlesElement.appendChild(cueNode);
subtitlesElement.appendChild(document.createElement('br'));
});
Expand Down
Loading