Superman allegedly gets his powers from "our yellow sun" (feel free to correct me on that as I'm a Superman newbie, but that was the impression I had). Has he ever been attacked by someone attempting to change the colour/nature of our sun to remove his powers?
Yes, though the attack wasn't directed specifically at Superman. The Post-Crisis storyline "The Final Night" deals with a story where the sun is under attack by a creature called the Sun-Eater. Superman is affected as his powers are slowly diminished by the loss of the sun.
The pedigree of this award-winning story is quite complicated:
- The Pre-Crisis Legion of Superheroes had a storyline where an alien weapon called the Sun-Eater was unleashed on the Earth sun in the 30th century.
A Sun-Eater is a living nebula with the ability to drain whole stars of all their energy; this snuffs out the star and causes its solar system to freeze (and all living beings in it to die). The Sun-Eaters were created by the alien race known as Controllers as a way to destroy entire worlds that they judged to be too "evil." Each Sun-Eater was kept in a dormant state until needed, watched over by a Controller.
- The Legion saga which was much beloved during that era eventually led to the Sun-Eater being defeated by Ferro Lad. The Sun Eater needed to be destroyed by flying an Absorbatron Bomb into it to kill it. Superboy couldn't do it after being exposed to red sun radiation already within the Sun Eater.
Ferro Lad was capable of delivering the bomb but died in the attempt. I confused this with an equally epic story in Superboy and the Legion of Superheroes #251 where Matter Eater Lad was forced to consume a device called the Miracle Machine in order to save the Earth. He was driven insane in the process.
Suffice it to say, the nostalgia-machine was activated during a period of Post-Crisis ennui and someone decided to revive that story for the 20th Century Earth and have a Sun-Eater come and attack the sun of our period.
During this time, Superman is living on borrowed rations while his powers are slowly reduced by the Sun-Eater blocking the sun. It is a decent story, but it goes on a bit long for my taste.
I don't recall any plot of this nature in standard DC comic series.
However, depending on how far you're willing to stretch, it was the plot of the first half of season nine of Smallville. Briefly, a bunch of former Kandorian military led by "Major" Zod are released, but without any typical powers of Kryptonians on Earth. They eventually learn that Jor-El had somehow reversed their genetics before they were sent to Earth so the yellow sun dampened their powers. (Apparently, every Kryptonian knows that they should have powers under a yellow sun.)
Lois is sent into the future where she sees that Zod has built a tower that somehow filters the atmosphere to change the yellow sun to a red one, simultaneously giving the Kandorians super powers and stripping Clark's from him, thus allowing them to conquer the planet. Clark prevents that future by destroying the tower before it can go online, but it is definitely seen that it would have worked.
The Yellow Sun explanation is one of many explanations that have been used.
Originally, his powers came from his alien heritage, Krypton had gravity many dozens of times stronger than Earth's, and since his species had evolved for that, he was much stronger than anyone on Earth (and could jump higher, was tougher, etc).
In the Silver Age of Comics, many ridiculous things happened. Superboy used 'Superweaving', Krypto the Superdog appeared, and practically any evil plot would happen.
Jimmy Olsen was taken to many other planets (most of which had blue or red suns) and gained super powers a LOT.
That said, I don't recall a specific plot where the color of our sun was changed - it wouldn't be likely anyway, since that would (under the loosly-defined 'rules' they had set up) grant everyone else on Earth superpowers.
This is really stretching it, but on the Superfriends TV series, there's one chapter ("Lex Luthor Strikes Back") when Lex Luthor forms an alliance with demons from the sun to defeat the Superfriends. These demons make the sun red, and Superman becomes powerless almost immediately.
But I wouldn't consider Super Friends to be canon.
In Superman: War of Supermen comic series, Luthor made our yellow sun red to attack all of Supermen...
While battling the evil alien Brainiac, Superman & Supergirl discovered the long-lost bottled city of Kandor which was stolen from Krypton prior to its destruction. Superman re-enlarged the city on Earth, but it wasn't welcomed by Humans. Humans assaulted the city in which Kryptonian's leader Zor-El (Supergirl's father) was killed. Using highly evolved science, Alura (Zor-El's wife) created a new planet "New Krypton". Plus, she, as a new leader, freed General Zod from Phantom Zone to command new super military of New Krypton (every kryptonians had super powers due to yellow sun).
While New Krypton & Earth were at cold war, Zod ordered his military to attack Earth. When military was in space, Sam Lane (Lois Lane's father) destroyed New Krypton by a trick making their race extinct again. Kryptonian military successfully crushed Earth's Mars defense facility & they headed towards Earth.
When they were about to enter atmosphere of Earth:
The closest thing I can think of didn't involve Superman, but did involve the planet Daxam. Krypton was said to be a colony of Daxam, so Daxamites have the same reaction to a yellow sun.
In the "Great Darkness Saga" in the Legion of Super-Heroes, Darkseid exchanged the planet Daxam with the planet Apokolips. Apokolips orbited a yellow sun.
By this technique, Darkseid created an entire planet of Supermen.
There was an episode of Superman:TAS called Solar Powered of which this was the exact basis. To Nutshell it: A human scientist called Edward Lytner takes on the persona of the villain Luminous and, seeking revenge on Superman who had put him into prison earlier, uses the Lex Corp satellites to diffuse the yellow rays of the sun and turn them red in earth's atmosphere.
You can see a fairly decent fan review of the episode here:
Now mind you, this version of Superman is significantly weaker on a whole than basically any other version, so the effects are noticeably more pronounced, but it's still pretty effective. It was also notable because this version of Superman had no naturally enhanced gravity-based or molecular density abilities; he was a purely solar-powered super hero.
Superman and the Legion of Super-Heroes was a Geoff Johns story in Action Comics which featured a xenophobic future Earth, and a sun turned red using Sun Boy's abilities. Superman loses his powers, and recovers them at the proverbial last moment when Sun-Boy is released.
Both this story and War of the Supermen play a bit fast and loose with the established process of Kryptonians' ability to get powers from the sun. To summarize, it's not on and off like a switch as much as it's like charging up a battery. Also, there's the fact that if the sun changed from red to yellow (or vice versa), it would take about seven minutes for Earth to notice, but I try not to let real-world physics get in the way of Comic Book Science.