Greasy Fork is available in English.

Discussions » Creation Requests

Yellow color + 150% font size for YouTube subtitles

§
Posted: 08-12-2022

I've been searching for a few hours trying to find the script which could be used to change the color and the size of the YouTube subtitles but couldn't find any. Is it possible there isn't such a script already done? I thought there would be many scripts for formatting YouTube subtitles.

My browsers open in Private/Incognito mode and each time I open a browser I have to change the YouTube subtitle font color to Yellow and subtitle font size to 150% manually.

§
Posted: 09-12-2022

All you need is too install some extension that applies custom CSS style.
Also of all you should enable extension working in incognito mode.

§
Posted: 14-12-2022

That might work for the subtitle font color but after activating 150% size option in the YT player's UI the font size still depends on if the video is watched in normal window, theathre mode or in full screen.

There should be a way to programmatically activate "Font size > 150%" option. I am not sure where the parameters are stored but if they are stored in the cookies then it might be possible to just recreate the cookie which contains the currently active Font size option selected in the player's UI.

§
Posted: 17-12-2022

I've found what I described could be done by creating the following element in local storage:

Key: yt-player-caption-display-settings
{data: "{"fontSizeIncrement":1,"color":"#ff0"}", expiration: epoch_time, creation: epoch_time}


expiration is creation + 30 days.

For font size 100% fontSizeIncrement has to be zero, for the lower font sizes the parameter is negative and for the larger fonts the parameter is positive.

There has to be yt-player-sticky-caption element with the value of "true".

Tested by changing the parameters with Developer Tools and refreshing the page.

§
Posted: 17-12-2022

This is the solution:

opcije = localStorage.getItem('yt-player-caption-display-settings');
if (opcije) {
parametri = JSON.parse(opcije);
parametri['data'] = '{"fontSizeIncrement":1,"color":"#ff0"}'
}
else {
parametri = {};
parametri["data"] = '{"fontSizeIncrement":1,"color":"#ff0"}';
danas = Date.now();
parametri["creation"] = danas;
parametri["expiration"] = danas + 30*864e5;
}
localStorage.setItem('yt-player-caption-display-settings', JSON.stringify(parametri));

Post reply

تسجيل الدخول إلى مرحلة ما بعد الرد.