THEME.libraries.yml having no effect
In D8 believe you need to wrap your code around this tags in order for Drupal to recognize it. 

(function ($, Drupal, window) {

 // code goes here

})(jQuery, Drupal, window);


So try

(function ($, Drupal, window) {
   $(window).on("scroll", function() {
     if ($(this).scrollTop() &gt; 50) {
       document.getElementById("logo").style.width = '150px';
       document.getElementById("logo").style.marginTop = '0px';
     } else {
       document.getElementById("logo").style.width = '300px';
       document.getElementById("logo").style.marginTop = '20px';
     }
   });
})(jQuery, Drupal, window);