From what I know, the whole system of belt ranks started with Judo. Originally a person would simply wear a uniform with a white belt and the same belt would be worn through their entire career. The purpose of the belt was simply to hold the jacket of the uniform closed. Then, sometime in the late 1800s, a Judo instructor gave black belts to his more advanced students to help tell them apart from the less advanced students. Other arts followed up on that and soon a whole colored belt system was created. Judo started it all though.
Oh boy. No. There's not a lot there that's really correct.
The part you got right is that it started with Judo... from there, uh... nope.
The form of obi (belt) worn in martial training is actually designed to be similar to the obi worn in armour... which was white, and was wrapped around the cords attaching the kusazuri to the do (the "skirt" to the chest plate/body armour). It was used to hold some weapons, as well as to protect (to a degree) the more vulnerable area at your waist (when you see do giri [body cuts] in many Kenjutsu systems, this is where they're aiming... Kendo aims a bit higher for safety). When it comes to wearing it with a keikogi (training uniform), that's a relatively modern training wear itself... dating from the mid-to-late Edo period. Initially, it was simply the under-kimono (almost what might be considered a form of underwear, really), which you would wear to protect the more delicate kimono itself. Different obi would be worn, depending on the group/art itself, and it's needs. Many weapon arts continued (and continue) to wear hakama and a more durable uwagi (jacket), these days simply referred to as a keikogi itself. With the keikogi/hakama combination, a different form of obi would be worn, a kaku obi or similar, which is much wider, stiffer, and tied differently in order to support a sword.
From there, we need to look at ranking systems. The most common traditional ranking system in Japanese arts is known as the Menkyo system (literally: "licence" system), where students would be awarded licences based on their experience and understanding of the art they're learning... often corresponding to particular areas of the syllabus (many Menkyo include lists of the waza [techniques] associated with that licence, called a Mokuroku [catalogue]). These licences might simply say that you've achieved a particular level, or might confer some authority to you to teach some or all of what you know (the same way a driving licence doesn't enable you to be a driving teacher, but does give you authority to drive a car). Although many arts have/had their own particular sequence and licencing forms, a rough "typical" (if we can use that term....) form might be: Kirigami ("cutting paper", an initial licence saying you've essentially been accepted, but with no authority in the Ryu yet), Shoden Menkyo (Initial Transmission Licence... you've learnt the first section of the tradition), Chuden Menkyo (Middle Transmission Licence... the second, or middle section), Okuden Menkyo (Inner Transmission Licence... a more advanced licence, often implying knowledge of a section held back from those lower licenced), Menkyo Kaiden (Full Transmission Licence... the highest rank, indicating that you've learnt the entire system). There would sometimes be licencing beyond Menkyo Kaiden, such as Betsuden Mokuroku ("Additional Transmission Catalogue"), or specific licencing to confer specific authority (such as a teaching licence... in other words, you might be Menkyo Kaiden, but not licenced as a teacher, or a lower licence holder, with a teaching authority). These licences might be to do with specialist knowledge, or might be to do with anything else, depending on the art itself.
Typically, there would be no outward signs of rank (such as coloured belts, patches, or anything similar), as the conferring of rank was done through the certificates/licences themselves. Additionally, each system would commonly only have one teacher/school (location), and everyone knew their place in the hierarchy of the dojo (the key was, if someone was there before you, they were senior... if they joined after you, they were junior)... so there was no such need. However, when Kano Jigoro began spreading Judo to the Universities and schools of Japan (through his association with the Ministry of Education), he found that he was being asked to teach at large gatherings of students that he had never met before. He needed a way to immediately look at a student and know (approximately) what their level of skill was. As a result, he developed a form of ranking not based on Menkyo licencing, but gradiated based on skills developed and demonstrated. He adopted an old ranking system that was used in the game of Go, known as Dan-i, which gave rank based on skills, divided up into Kyu (student) and Dan (level)... depending on the group, there would be thirty or more Kyu grades in Go, however Kano decided on 9 (or 10, depending on how you look at it). The Go form of Dan ranks distinguished between amateur and professional ranking, however Kano's Dan ranks simply covered a single grouping.
As time went on, other systems began to adopt similar approaches, based in very much the same ideas, but with each given their own interpretation. It should be noted that there was no "upper limit" to the Dan grades that Kano applied... it just happened that it petered out from 9th or so, so many assume that's the limit. Theoretically, there isn't a limit... and each art is free to come up with their own application themselves. Some arts I know of have 3 Kyu grades... some have 6... some 10... some 9... and some simply forgo it completely to start at Shodan (First Level). After Judo, Karate was the next to apply the Dan-i rankings, and really took the coloured belts and ran with it. Aikido was next, with Ueshiba deciding that his most senior students (who had been awarded Menkyo Kaiden, for the record) should be awarded 8th Dan. Many Aikido schools only use a white belt, then a black one (often coupled with a hakama), some use a few others (it's a little more common with kids, keeping their interest, and preventing them from attaining a "black belt" too quickly). It's since spread to be fairly common... to the point that it's often mistaken to be "standard", or "standardized". It's not. Realistically, there isn't a single approach, despite commonalities.
It also gets a little more complicated when Shogo titles are used... these are titles used within an organization (begun with the Dai Nippon Butoku-kai) for distinctions of the roles played by different members. These titles include Renshi, Kyoshi, and Hanshi (each distinct affectations of teachers, in ascending order). There may be rank requirements (6th Dan for Renshi, 7th for Kyoshi, 8th for Hanshi), but that doesn't mean that all 6th Dan holders are Renshi, for example. Finally, there are the specific titles held regardless of rank, or even separate from it, such as Kancho ("Hall Chief", President, or the head of an organization), Sensei (often taken as "teacher", but it really refers to someone of greater experience, and is not exclusive or unique to martial arts), Shihan (again, often given as "Master", or "Master Teacher", this actually pretty simply means "teacher"... but often refers to the most senior of a group of teachers, if there is one), Soke (a traditional title passed from the previous Soke [in other words, you can't become Soke by deciding to call yourself that, or by being "awarded" the title by a council or similar] which means "head of the family". This is probably the most mis-used title around, and many who are not the heads of traditional arts who use it should be given a wide berth), Shidoshi (a Bujinkan title for a teacher, similar to the Katori Shinto Ryu Shidosha teaching licence... the term "Shidoshi" was coined by Hatsumi. Schools outside of the Bujinkan using it is just, well... not right), Sempai (Senpai, both are correct) and Kohai (senior and junior respectively).