(None of this applies in this case, because the code was evidently literally copied and pasted. Let's assume it was just design inspiration. IANAL.)

This would be a question of fair use in derivative works: https://en.wikipedia.org/wiki/Derivative_work#The_fair_use_d...

You're balancing a couple factors here. First, there's the question of whether it's derivative at all. That requires the work be substantively new and different, which the OP probably doesn't meet. See the Batlin standard:

>However, his appeal was denied and the injunction against Snyder's copyright upheld (six members of the court voted to deny, the other three filing a dissenting opinion). Much of this decision focused on the fact that nearly all of the alterations in Snyder's version were made solely to allow the object to be more easily manufactured in plastic rather than metal, and therefore were functional, not artistic or creative... The issue was not whether or not Batlin's bank was a copy of Snyder's— it undoubtedly was— but whether or not Snyder could claim copyright protection, which the court decided he could not.

The OP really only makes changes to make it their company's product, so it's probably just copying, not deriving. But let's assume it passes that standard. We'd still need to justify fair use, which sets 3 standards: (https://en.wikipedia.org/wiki/Fair_use)

1. the purpose and character of the use, including whether such use is of a commercial nature or is for nonprofit educational purposes;

This is a commercial project copying another company. Won't get much sympathy here.

2. the nature of the copyrighted work;

>Although the Supreme Court of the United States has ruled that the availability of copyright protection should not depend on the artistic quality or merit of a work, fair use analyses consider certain aspects of the work to be relevant, such as whether it is fictional or non-fictional.

This one doesn't seem to apply much here, it's more for works of 'importance.' For example, the Zapruder film's copyright was invalidated on these grounds when Time tried to enforce it. Maybe you could argue that Facebook is so iconic that its designs have become a part of the artistic zeitgeist, but probably not for some random spinoff.

3. the amount and substantiality of the portion used in relation to the copyrighted work as a whole;

>The third factor assesses the quantity or percentage of the original copyrighted work that has been imported into the new work. In general, the less that is used in relation to the whole, ex: a few sentences of a text for a book review, the more likely that the sample will be considered fair use.

Looks like just about all of it...

4. and the effect of the use upon the potential market for or value of the copyrighted work.

Probably some good news here. Nuggets copying the Rooms design probably doesn't hurt Facebook much. Arguably it even helps them, since we're talking about it here.

Overall, not a very good case for these guys, but I assume you're thinking about more ambiguous hypotheticals. Fair use is a spectrum, aimed at protecting people against spurious or unfair copyright claims. Chances are if a use seems reasonable, it can be defended on fair use grounds in court. If it's blatant and unfair, it'll probably be shot down. But it's altogether unclear until litigation happens, because only courts decide.